Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"repository": "https://github.com/getlift/lift",
"description": "Lift",
"dependencies": {
"@aws-cdk/aws-apigatewayv2-alpha": "^2.21.1-alpha.0",
"aws-cdk-lib": "^2.21.1",
"aws-cdk-lib": "^2.215.0",
"chalk": "^4.1.1",
"change-case": "^4.1.2",
"cidr-split": "^0.1.2",
Expand Down
8 changes: 3 additions & 5 deletions src/constructs/aws/ServerSideWebsite.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { CfnBucket } from "aws-cdk-lib/aws-s3";
import { Bucket } from "aws-cdk-lib/aws-s3";
import type { CfnDistribution, IOriginRequestPolicy } from "aws-cdk-lib/aws-cloudfront";
import type { CfnDistribution } from "aws-cdk-lib/aws-cloudfront";
import { OriginRequestPolicy } from "aws-cdk-lib/aws-cloudfront";
import {
AllowedMethods,
CachePolicy,
Expand Down Expand Up @@ -109,10 +110,7 @@ export class ServerSideWebsite extends AwsConstruct {
});

// https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html#managed-origin-request-policy-all-viewer-except-host-header
// It is not supported by the AWS CDK yet
const backendOriginPolicy = new (class implements IOriginRequestPolicy {
public readonly originRequestPolicyId = "b689b0a8-53d0-40ab-baf2-68738e2966ac";
})();
const backendOriginPolicy = OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER;
const backendCachePolicy = CachePolicy.CACHING_DISABLED;

const apiId =
Expand Down
3 changes: 1 addition & 2 deletions src/constructs/aws/Webhook.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { Construct as CdkConstruct } from "constructs";
import type { CfnResource } from "aws-cdk-lib";
import { CfnOutput, Fn } from "aws-cdk-lib";
import { CfnAuthorizer, CfnIntegration, CfnRoute } from "aws-cdk-lib/aws-apigatewayv2";
import { HttpApi } from "@aws-cdk/aws-apigatewayv2-alpha";
import { CfnAuthorizer, CfnIntegration, CfnRoute, HttpApi } from "aws-cdk-lib/aws-apigatewayv2";
import { Function } from "aws-cdk-lib/aws-lambda";
import type { CfnEventBus } from "aws-cdk-lib/aws-events";
import { EventBus } from "aws-cdk-lib/aws-events";
Expand Down
4 changes: 2 additions & 2 deletions test/unit/serverSideWebsite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe("server-side website", () => {
{
EventType: "viewer-request",
FunctionARN: {
"Fn::GetAtt": [requestFunction, "FunctionARN"],
Ref: requestFunction,
},
},
],
Expand Down Expand Up @@ -209,7 +209,7 @@ describe("server-side website", () => {
FunctionAssociations: [
{
EventType: "viewer-request",
FunctionARN: { "Fn::GetAtt": [requestFunction, "FunctionARN"] },
FunctionARN: { Ref: requestFunction },
},
],
},
Expand Down
5 changes: 1 addition & 4 deletions test/unit/singlePageApp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ describe("single page app", () => {
Object {
"EventType": "viewer-response",
"FunctionARN": Object {
"Fn::GetAtt": Array [
"${responseFunction}",
"FunctionARN",
],
"Ref": "${responseFunction}",
},
},
Object {
Expand Down
43 changes: 20 additions & 23 deletions test/unit/staticWebsite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe("static websites", () => {
{
EventType: "viewer-response",
FunctionARN: {
"Fn::GetAtt": [responseFunction, "FunctionARN"],
Ref: responseFunction,
},
},
],
Expand Down Expand Up @@ -374,27 +374,24 @@ describe("static websites", () => {
"Properties.DistributionConfig.DefaultCacheBehavior.FunctionAssociations"
)
).toMatchInlineSnapshot(`
Array [
Object {
"EventType": "viewer-response",
"FunctionARN": Object {
"Fn::GetAtt": Array [
"${responseFunction}",
"FunctionARN",
],
},
},
Object {
"EventType": "viewer-request",
"FunctionARN": Object {
"Fn::GetAtt": Array [
"${requestFunction}",
"FunctionARN",
],
},
},
]
`);
Array [
Object {
"EventType": "viewer-response",
"FunctionARN": Object {
"Ref": "${responseFunction}",
},
},
Object {
"EventType": "viewer-request",
"FunctionARN": Object {
"Fn::GetAtt": Array [
"${requestFunction}",
"FunctionARN",
],
},
},
]
`);
});

it("should allow to customize the error page", async () => {
Expand Down Expand Up @@ -441,7 +438,7 @@ describe("static websites", () => {
{
EventType: "viewer-response",
FunctionARN: {
"Fn::GetAtt": [responseFunction, "FunctionARN"],
Ref: responseFunction,
},
},
],
Expand Down
Loading