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 @@ -452,6 +452,12 @@ class NextjsComponent extends Component {
452
452
. initialRevalidateSeconds === "number"
453
453
) ;
454
454
455
+ const hasDynamicISRPages = Object . keys (
456
+ defaultBuildManifest . pages . ssg . dynamic
457
+ ) . some (
458
+ ( key ) => defaultBuildManifest . pages . ssg . dynamic [ key ] . fallback !== false
459
+ ) ;
460
+
455
461
const readLambdaInputValue = (
456
462
inputKey : "memory" | "timeout" | "name" | "runtime" | "roleArn" | "tags" ,
457
463
lambdaType : LambdaType ,
@@ -471,7 +477,7 @@ class NextjsComponent extends Component {
471
477
} ;
472
478
473
479
let queue ;
474
- if ( hasISRPages ) {
480
+ if ( hasISRPages || hasDynamicISRPages ) {
475
481
queue = await sqs ( {
476
482
name : `${ bucketOutputs . name } .fifo` ,
477
483
deduplicationScope : "messageGroup" ,
@@ -521,7 +527,7 @@ class NextjsComponent extends Component {
521
527
}
522
528
}
523
529
524
- if ( hasISRPages ) {
530
+ if ( hasISRPages || hasDynamicISRPages ) {
525
531
const regenerationLambdaInput : LambdaInput = {
526
532
region : bucketRegion , // make sure SQS region and regeneration lambda region are the same
527
533
description : inputs . description
You can’t perform that action at this time.
0 commit comments