Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit 869b6a8

Browse files
authored
add search and fix prettier lint errors (#6)
1 parent 57fa570 commit 869b6a8

File tree

1 file changed

+40
-21
lines changed
  • packages/serverless-components/nextjs-component/src

1 file changed

+40
-21
lines changed

packages/serverless-components/nextjs-component/src/component.ts

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@ class NextjsComponent extends Component {
424424
];
425425

426426
console.log(cloudFrontOrigins[0]);
427-
428427

429428
cloudFrontOrigins[1].pathPatterns[
430429
this.pathPattern("_next/static/*", routesManifest)
@@ -839,8 +838,8 @@ class NextjsComponent extends Component {
839838
forward: {
840839
cookies: "all",
841840
headers: routesManifest.i18n
842-
? ["Accept-Language", "Authorization", "Host"]
843-
: ["Authorization", "Host"],
841+
? ["Accept-Language", "Authorization", "Host"]
842+
: ["Authorization", "Host"],
844843
queryString: true
845844
},
846845
// lambda@edge key is last and therefore cannot be overridden
@@ -859,8 +858,8 @@ class NextjsComponent extends Component {
859858
forward: {
860859
cookies: "all",
861860
headers: routesManifest.i18n
862-
? ["Accept-Language", "Authorization", "Host"]
863-
: ["Authorization", "Host"],
861+
? ["Accept-Language", "Authorization", "Host"]
862+
: ["Authorization", "Host"],
864863
queryString: true
865864
},
866865
// lambda@edge key is last and therefore cannot be overridden
@@ -879,8 +878,8 @@ class NextjsComponent extends Component {
879878
forward: {
880879
cookies: "all",
881880
headers: routesManifest.i18n
882-
? ["Accept-Language", "Authorization", "Host"]
883-
: ["Authorization", "Host"],
881+
? ["Accept-Language", "Authorization", "Host"]
882+
: ["Authorization", "Host"],
884883
queryString: true
885884
},
886885
// lambda@edge key is last and therefore cannot be overridden
@@ -899,8 +898,8 @@ class NextjsComponent extends Component {
899898
forward: {
900899
cookies: "all",
901900
headers: routesManifest.i18n
902-
? ["Accept-Language", "Authorization", "Host"]
903-
: ["Authorization", "Host"],
901+
? ["Accept-Language", "Authorization", "Host"]
902+
: ["Authorization", "Host"],
904903
queryString: true
905904
},
906905
// lambda@edge key is last and therefore cannot be overridden
@@ -919,8 +918,8 @@ class NextjsComponent extends Component {
919918
forward: {
920919
cookies: "all",
921920
headers: routesManifest.i18n
922-
? ["Accept-Language", "Authorization", "Host"]
923-
: ["Authorization", "Host"],
921+
? ["Accept-Language", "Authorization", "Host"]
922+
: ["Authorization", "Host"],
924923
queryString: true
925924
},
926925
// lambda@edge key is last and therefore cannot be overridden
@@ -938,8 +937,8 @@ class NextjsComponent extends Component {
938937
forward: {
939938
cookies: "all",
940939
headers: routesManifest.i18n
941-
? ["Accept-Language", "Authorization", "Host"]
942-
: ["Authorization", "Host"],
940+
? ["Accept-Language", "Authorization", "Host"]
941+
: ["Authorization", "Host"],
943942
queryString: true
944943
},
945944
// lambda@edge key is last and therefore cannot be overridden
@@ -958,8 +957,8 @@ class NextjsComponent extends Component {
958957
forward: {
959958
cookies: "all",
960959
headers: routesManifest.i18n
961-
? ["Accept-Language", "Authorization", "Host"]
962-
: ["Authorization", "Host"],
960+
? ["Accept-Language", "Authorization", "Host"]
961+
: ["Authorization", "Host"],
963962
queryString: true
964963
},
965964
// lambda@edge key is last and therefore cannot be overridden
@@ -968,7 +967,7 @@ class NextjsComponent extends Component {
968967
"origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`
969968
}
970969
};
971-
970+
972971
cloudFrontOrigins[1].pathPatterns[
973972
this.pathPattern("/support*", routesManifest)
974973
] = {
@@ -978,8 +977,8 @@ class NextjsComponent extends Component {
978977
forward: {
979978
cookies: "all",
980979
headers: routesManifest.i18n
981-
? ["Accept-Language", "Authorization", "Host"]
982-
: ["Authorization", "Host"],
980+
? ["Accept-Language", "Authorization", "Host"]
981+
: ["Authorization", "Host"],
983982
queryString: true
984983
},
985984
// lambda@edge key is last and therefore cannot be overridden
@@ -998,8 +997,28 @@ class NextjsComponent extends Component {
998997
forward: {
999998
cookies: "all",
1000999
headers: routesManifest.i18n
1001-
? ["Accept-Language", "Authorization", "Host"]
1002-
: ["Authorization", "Host"],
1000+
? ["Accept-Language", "Authorization", "Host"]
1001+
: ["Authorization", "Host"],
1002+
queryString: true
1003+
},
1004+
// lambda@edge key is last and therefore cannot be overridden
1005+
"lambda@edge": {
1006+
"origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`,
1007+
"origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`
1008+
}
1009+
};
1010+
1011+
cloudFrontOrigins[1].pathPatterns[
1012+
this.pathPattern("/search*", routesManifest)
1013+
] = {
1014+
minTTL: 0,
1015+
defaultTTL: 0,
1016+
maxTTL: 86400,
1017+
forward: {
1018+
cookies: "all",
1019+
headers: routesManifest.i18n
1020+
? ["Accept-Language", "Authorization", "Host"]
1021+
: ["Authorization", "Host"],
10031022
queryString: true
10041023
},
10051024
// lambda@edge key is last and therefore cannot be overridden
@@ -1101,7 +1120,7 @@ class NextjsComponent extends Component {
11011120
const cloudFrontOutputs = await cloudFront({
11021121
bucketRegion: bucketRegion,
11031122
distributionId: cloudFrontDistributionId,
1104-
defaults: {
1123+
defaults: {
11051124
minTTL: 0,
11061125
defaultTTL: 0,
11071126
maxTTL: 31536000,

0 commit comments

Comments
 (0)