This repository was archived by the owner on Jan 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
packages/serverless-components Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,13 @@ export class NextJSLambdaEdge extends cdk.Construct {
95
95
"number"
96
96
) ;
97
97
98
- if ( hasISRPages ) {
98
+ const hasDynamicISRPages = Object . keys (
99
+ this . prerenderManifest . dynamicRoutes
100
+ ) . some (
101
+ ( key ) => this . prerenderManifest . dynamicRoutes [ key ] . fallback !== false
102
+ ) ;
103
+
104
+ if ( hasISRPages || hasDynamicISRPages ) {
99
105
this . regenerationQueue = new sqs . Queue ( this , "RegenerationQueue" , {
100
106
// We call the queue the same name as the bucket so that we can easily
101
107
// reference it from within the lambda@edge , given we can't use env vars
@@ -160,7 +166,7 @@ export class NextJSLambdaEdge extends cdk.Construct {
160
166
this . bucket . grantReadWrite ( this . defaultNextLambda ) ;
161
167
this . defaultNextLambda . currentVersion . addAlias ( "live" ) ;
162
168
163
- if ( hasISRPages && this . regenerationFunction ) {
169
+ if ( ( hasISRPages || hasDynamicISRPages ) && this . regenerationFunction ) {
164
170
this . bucket . grantReadWrite ( this . regenerationFunction ) ;
165
171
this . regenerationQueue ?. grantSendMessages ( this . defaultNextLambda ) ;
166
172
this . regenerationFunction ?. grantInvoke ( this . defaultNextLambda ) ;
Original file line number Diff line number Diff line change @@ -453,6 +453,12 @@ class NextjsComponent extends Component {
453
453
. initialRevalidateSeconds === "number"
454
454
) ;
455
455
456
+ const hasDynamicISRPages = Object . keys (
457
+ defaultBuildManifest . pages . ssg . dynamic
458
+ ) . some (
459
+ ( key ) => defaultBuildManifest . pages . ssg . dynamic [ key ] . fallback !== false
460
+ ) ;
461
+
456
462
const readLambdaInputValue = (
457
463
inputKey : "memory" | "timeout" | "name" | "runtime" | "roleArn" | "tags" ,
458
464
lambdaType : LambdaType ,
@@ -472,7 +478,7 @@ class NextjsComponent extends Component {
472
478
} ;
473
479
474
480
let queue ;
475
- if ( hasISRPages ) {
481
+ if ( hasISRPages || hasDynamicISRPages ) {
476
482
queue = await sqs ( {
477
483
name : `${ bucketOutputs . name } .fifo` ,
478
484
deduplicationScope : "messageGroup" ,
@@ -522,7 +528,7 @@ class NextjsComponent extends Component {
522
528
}
523
529
}
524
530
525
- if ( hasISRPages ) {
531
+ if ( hasISRPages || hasDynamicISRPages ) {
526
532
const regenerationLambdaInput : LambdaInput = {
527
533
region : bucketRegion , // make sure SQS region and regeneration lambda region are the same
528
534
description : inputs . description
You can’t perform that action at this time.
0 commit comments