cdk-nextjs 0.5.13 → 0.5.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +40 -40
- package/docs/caching-guide.md +3 -0
- package/lib/adapter/cache-handler.mjs +50916 -13061
- package/lib/adapter/memory-cache-handler.d.ts +1 -1
- package/lib/adapter/memory-cache-handler.js +17 -11
- package/lib/adapter/memory-cache-handler.test.js +57 -1
- package/lib/adapter/s3-cache-handler.d.ts +33 -0
- package/lib/adapter/s3-cache-handler.js +96 -1
- package/lib/adapter/s3-cache-handler.test.js +66 -1
- package/lib/nextjs-api.js +1 -1
- package/lib/nextjs-build/functions.Dockerfile +2 -0
- package/lib/nextjs-build/global-containers.Dockerfile +2 -0
- package/lib/nextjs-build/nextjs-build.js +1 -1
- package/lib/nextjs-cache.js +1 -1
- package/lib/nextjs-compute/nextjs-containers.js +1 -1
- package/lib/nextjs-compute/nextjs-functions.js +1 -1
- package/lib/nextjs-distribution.js +1 -1
- package/lib/nextjs-post-deploy.js +1 -1
- package/lib/nextjs-static-assets.js +1 -1
- package/lib/root-constructs/nextjs-base-construct.js +1 -1
- package/lib/root-constructs/nextjs-global-containers.d.ts +15 -0
- package/lib/root-constructs/nextjs-global-containers.js +57 -2
- package/lib/root-constructs/nextjs-global-functions.d.ts +16 -0
- package/lib/root-constructs/nextjs-global-functions.js +56 -2
- package/lib/root-constructs/nextjs-regional-containers.js +1 -1
- package/lib/root-constructs/nextjs-regional-functions.js +1 -1
- package/package.json +2 -1
package/.jsii
CHANGED
|
@@ -11348,7 +11348,7 @@
|
|
|
11348
11348
|
},
|
|
11349
11349
|
"locationInModule": {
|
|
11350
11350
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11351
|
-
"line":
|
|
11351
|
+
"line": 89
|
|
11352
11352
|
},
|
|
11353
11353
|
"parameters": [
|
|
11354
11354
|
{
|
|
@@ -11374,7 +11374,7 @@
|
|
|
11374
11374
|
"kind": "class",
|
|
11375
11375
|
"locationInModule": {
|
|
11376
11376
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11377
|
-
"line":
|
|
11377
|
+
"line": 79
|
|
11378
11378
|
},
|
|
11379
11379
|
"name": "NextjsGlobalContainers",
|
|
11380
11380
|
"properties": [
|
|
@@ -11385,7 +11385,7 @@
|
|
|
11385
11385
|
"immutable": true,
|
|
11386
11386
|
"locationInModule": {
|
|
11387
11387
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11388
|
-
"line":
|
|
11388
|
+
"line": 83
|
|
11389
11389
|
},
|
|
11390
11390
|
"name": "url",
|
|
11391
11391
|
"overrides": "cdk-nextjs.NextjsBaseConstruct",
|
|
@@ -11399,7 +11399,7 @@
|
|
|
11399
11399
|
},
|
|
11400
11400
|
"locationInModule": {
|
|
11401
11401
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11402
|
-
"line":
|
|
11402
|
+
"line": 80
|
|
11403
11403
|
},
|
|
11404
11404
|
"name": "nextjsContainers",
|
|
11405
11405
|
"type": {
|
|
@@ -11412,7 +11412,7 @@
|
|
|
11412
11412
|
},
|
|
11413
11413
|
"locationInModule": {
|
|
11414
11414
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11415
|
-
"line":
|
|
11415
|
+
"line": 81
|
|
11416
11416
|
},
|
|
11417
11417
|
"name": "nextjsDistribution",
|
|
11418
11418
|
"type": {
|
|
@@ -11425,7 +11425,7 @@
|
|
|
11425
11425
|
},
|
|
11426
11426
|
"locationInModule": {
|
|
11427
11427
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11428
|
-
"line":
|
|
11428
|
+
"line": 82
|
|
11429
11429
|
},
|
|
11430
11430
|
"name": "nextjsPostDeploy",
|
|
11431
11431
|
"type": {
|
|
@@ -11448,7 +11448,7 @@
|
|
|
11448
11448
|
"kind": "interface",
|
|
11449
11449
|
"locationInModule": {
|
|
11450
11450
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11451
|
-
"line":
|
|
11451
|
+
"line": 31
|
|
11452
11452
|
},
|
|
11453
11453
|
"name": "NextjsGlobalContainersConstructOverrides",
|
|
11454
11454
|
"properties": [
|
|
@@ -11460,7 +11460,7 @@
|
|
|
11460
11460
|
"immutable": true,
|
|
11461
11461
|
"locationInModule": {
|
|
11462
11462
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11463
|
-
"line":
|
|
11463
|
+
"line": 32
|
|
11464
11464
|
},
|
|
11465
11465
|
"name": "nextjsContainersProps",
|
|
11466
11466
|
"optional": true,
|
|
@@ -11476,7 +11476,7 @@
|
|
|
11476
11476
|
"immutable": true,
|
|
11477
11477
|
"locationInModule": {
|
|
11478
11478
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11479
|
-
"line":
|
|
11479
|
+
"line": 33
|
|
11480
11480
|
},
|
|
11481
11481
|
"name": "nextjsDistributionProps",
|
|
11482
11482
|
"optional": true,
|
|
@@ -11492,7 +11492,7 @@
|
|
|
11492
11492
|
"immutable": true,
|
|
11493
11493
|
"locationInModule": {
|
|
11494
11494
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11495
|
-
"line":
|
|
11495
|
+
"line": 34
|
|
11496
11496
|
},
|
|
11497
11497
|
"name": "nextjsPostDeployProps",
|
|
11498
11498
|
"optional": true,
|
|
@@ -11518,7 +11518,7 @@
|
|
|
11518
11518
|
"kind": "interface",
|
|
11519
11519
|
"locationInModule": {
|
|
11520
11520
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11521
|
-
"line":
|
|
11521
|
+
"line": 42
|
|
11522
11522
|
},
|
|
11523
11523
|
"name": "NextjsGlobalContainersOverrides",
|
|
11524
11524
|
"properties": [
|
|
@@ -11530,7 +11530,7 @@
|
|
|
11530
11530
|
"immutable": true,
|
|
11531
11531
|
"locationInModule": {
|
|
11532
11532
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11533
|
-
"line":
|
|
11533
|
+
"line": 44
|
|
11534
11534
|
},
|
|
11535
11535
|
"name": "nextjsContainers",
|
|
11536
11536
|
"optional": true,
|
|
@@ -11546,7 +11546,7 @@
|
|
|
11546
11546
|
"immutable": true,
|
|
11547
11547
|
"locationInModule": {
|
|
11548
11548
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11549
|
-
"line":
|
|
11549
|
+
"line": 45
|
|
11550
11550
|
},
|
|
11551
11551
|
"name": "nextjsDistribution",
|
|
11552
11552
|
"optional": true,
|
|
@@ -11562,7 +11562,7 @@
|
|
|
11562
11562
|
"immutable": true,
|
|
11563
11563
|
"locationInModule": {
|
|
11564
11564
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11565
|
-
"line":
|
|
11565
|
+
"line": 43
|
|
11566
11566
|
},
|
|
11567
11567
|
"name": "nextjsGlobalContainers",
|
|
11568
11568
|
"optional": true,
|
|
@@ -11578,7 +11578,7 @@
|
|
|
11578
11578
|
"immutable": true,
|
|
11579
11579
|
"locationInModule": {
|
|
11580
11580
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11581
|
-
"line":
|
|
11581
|
+
"line": 46
|
|
11582
11582
|
},
|
|
11583
11583
|
"name": "nextjsPostDeploy",
|
|
11584
11584
|
"optional": true,
|
|
@@ -11602,7 +11602,7 @@
|
|
|
11602
11602
|
"kind": "interface",
|
|
11603
11603
|
"locationInModule": {
|
|
11604
11604
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11605
|
-
"line":
|
|
11605
|
+
"line": 49
|
|
11606
11606
|
},
|
|
11607
11607
|
"name": "NextjsGlobalContainersProps",
|
|
11608
11608
|
"properties": [
|
|
@@ -11616,7 +11616,7 @@
|
|
|
11616
11616
|
"immutable": true,
|
|
11617
11617
|
"locationInModule": {
|
|
11618
11618
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11619
|
-
"line":
|
|
11619
|
+
"line": 56
|
|
11620
11620
|
},
|
|
11621
11621
|
"name": "alb",
|
|
11622
11622
|
"optional": true,
|
|
@@ -11634,7 +11634,7 @@
|
|
|
11634
11634
|
"immutable": true,
|
|
11635
11635
|
"locationInModule": {
|
|
11636
11636
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11637
|
-
"line":
|
|
11637
|
+
"line": 61
|
|
11638
11638
|
},
|
|
11639
11639
|
"name": "distribution",
|
|
11640
11640
|
"optional": true,
|
|
@@ -11652,7 +11652,7 @@
|
|
|
11652
11652
|
"immutable": true,
|
|
11653
11653
|
"locationInModule": {
|
|
11654
11654
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11655
|
-
"line":
|
|
11655
|
+
"line": 66
|
|
11656
11656
|
},
|
|
11657
11657
|
"name": "ecsCluster",
|
|
11658
11658
|
"optional": true,
|
|
@@ -11669,7 +11669,7 @@
|
|
|
11669
11669
|
"immutable": true,
|
|
11670
11670
|
"locationInModule": {
|
|
11671
11671
|
"filename": "src/root-constructs/nextjs-global-containers.ts",
|
|
11672
|
-
"line":
|
|
11672
|
+
"line": 70
|
|
11673
11673
|
},
|
|
11674
11674
|
"name": "overrides",
|
|
11675
11675
|
"optional": true,
|
|
@@ -11694,7 +11694,7 @@
|
|
|
11694
11694
|
},
|
|
11695
11695
|
"locationInModule": {
|
|
11696
11696
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11697
|
-
"line":
|
|
11697
|
+
"line": 75
|
|
11698
11698
|
},
|
|
11699
11699
|
"parameters": [
|
|
11700
11700
|
{
|
|
@@ -11720,7 +11720,7 @@
|
|
|
11720
11720
|
"kind": "class",
|
|
11721
11721
|
"locationInModule": {
|
|
11722
11722
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11723
|
-
"line":
|
|
11723
|
+
"line": 65
|
|
11724
11724
|
},
|
|
11725
11725
|
"name": "NextjsGlobalFunctions",
|
|
11726
11726
|
"properties": [
|
|
@@ -11731,7 +11731,7 @@
|
|
|
11731
11731
|
"immutable": true,
|
|
11732
11732
|
"locationInModule": {
|
|
11733
11733
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11734
|
-
"line":
|
|
11734
|
+
"line": 69
|
|
11735
11735
|
},
|
|
11736
11736
|
"name": "url",
|
|
11737
11737
|
"overrides": "cdk-nextjs.NextjsBaseConstruct",
|
|
@@ -11745,7 +11745,7 @@
|
|
|
11745
11745
|
},
|
|
11746
11746
|
"locationInModule": {
|
|
11747
11747
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11748
|
-
"line":
|
|
11748
|
+
"line": 67
|
|
11749
11749
|
},
|
|
11750
11750
|
"name": "nextjsDistribution",
|
|
11751
11751
|
"type": {
|
|
@@ -11758,7 +11758,7 @@
|
|
|
11758
11758
|
},
|
|
11759
11759
|
"locationInModule": {
|
|
11760
11760
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11761
|
-
"line":
|
|
11761
|
+
"line": 66
|
|
11762
11762
|
},
|
|
11763
11763
|
"name": "nextjsFunctions",
|
|
11764
11764
|
"type": {
|
|
@@ -11771,7 +11771,7 @@
|
|
|
11771
11771
|
},
|
|
11772
11772
|
"locationInModule": {
|
|
11773
11773
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11774
|
-
"line":
|
|
11774
|
+
"line": 68
|
|
11775
11775
|
},
|
|
11776
11776
|
"name": "nextjsPostDeploy",
|
|
11777
11777
|
"type": {
|
|
@@ -11794,7 +11794,7 @@
|
|
|
11794
11794
|
"kind": "interface",
|
|
11795
11795
|
"locationInModule": {
|
|
11796
11796
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11797
|
-
"line":
|
|
11797
|
+
"line": 29
|
|
11798
11798
|
},
|
|
11799
11799
|
"name": "NextjsGlobalFunctionsConstructOverrides",
|
|
11800
11800
|
"properties": [
|
|
@@ -11806,7 +11806,7 @@
|
|
|
11806
11806
|
"immutable": true,
|
|
11807
11807
|
"locationInModule": {
|
|
11808
11808
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11809
|
-
"line":
|
|
11809
|
+
"line": 31
|
|
11810
11810
|
},
|
|
11811
11811
|
"name": "nextjsDistributionProps",
|
|
11812
11812
|
"optional": true,
|
|
@@ -11822,7 +11822,7 @@
|
|
|
11822
11822
|
"immutable": true,
|
|
11823
11823
|
"locationInModule": {
|
|
11824
11824
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11825
|
-
"line":
|
|
11825
|
+
"line": 30
|
|
11826
11826
|
},
|
|
11827
11827
|
"name": "nextjsFunctionsProps",
|
|
11828
11828
|
"optional": true,
|
|
@@ -11838,7 +11838,7 @@
|
|
|
11838
11838
|
"immutable": true,
|
|
11839
11839
|
"locationInModule": {
|
|
11840
11840
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11841
|
-
"line":
|
|
11841
|
+
"line": 32
|
|
11842
11842
|
},
|
|
11843
11843
|
"name": "nextjsPostDeployProps",
|
|
11844
11844
|
"optional": true,
|
|
@@ -11864,7 +11864,7 @@
|
|
|
11864
11864
|
"kind": "interface",
|
|
11865
11865
|
"locationInModule": {
|
|
11866
11866
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11867
|
-
"line":
|
|
11867
|
+
"line": 40
|
|
11868
11868
|
},
|
|
11869
11869
|
"name": "NextjsGlobalFunctionsOverrides",
|
|
11870
11870
|
"properties": [
|
|
@@ -11876,7 +11876,7 @@
|
|
|
11876
11876
|
"immutable": true,
|
|
11877
11877
|
"locationInModule": {
|
|
11878
11878
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11879
|
-
"line":
|
|
11879
|
+
"line": 43
|
|
11880
11880
|
},
|
|
11881
11881
|
"name": "nextjsDistribution",
|
|
11882
11882
|
"optional": true,
|
|
@@ -11892,7 +11892,7 @@
|
|
|
11892
11892
|
"immutable": true,
|
|
11893
11893
|
"locationInModule": {
|
|
11894
11894
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11895
|
-
"line":
|
|
11895
|
+
"line": 42
|
|
11896
11896
|
},
|
|
11897
11897
|
"name": "nextjsFunctions",
|
|
11898
11898
|
"optional": true,
|
|
@@ -11908,7 +11908,7 @@
|
|
|
11908
11908
|
"immutable": true,
|
|
11909
11909
|
"locationInModule": {
|
|
11910
11910
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11911
|
-
"line":
|
|
11911
|
+
"line": 41
|
|
11912
11912
|
},
|
|
11913
11913
|
"name": "nextjsGlobalFunctions",
|
|
11914
11914
|
"optional": true,
|
|
@@ -11924,7 +11924,7 @@
|
|
|
11924
11924
|
"immutable": true,
|
|
11925
11925
|
"locationInModule": {
|
|
11926
11926
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11927
|
-
"line":
|
|
11927
|
+
"line": 44
|
|
11928
11928
|
},
|
|
11929
11929
|
"name": "nextjsPostDeploy",
|
|
11930
11930
|
"optional": true,
|
|
@@ -11948,7 +11948,7 @@
|
|
|
11948
11948
|
"kind": "interface",
|
|
11949
11949
|
"locationInModule": {
|
|
11950
11950
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11951
|
-
"line":
|
|
11951
|
+
"line": 47
|
|
11952
11952
|
},
|
|
11953
11953
|
"name": "NextjsGlobalFunctionsProps",
|
|
11954
11954
|
"properties": [
|
|
@@ -11962,7 +11962,7 @@
|
|
|
11962
11962
|
"immutable": true,
|
|
11963
11963
|
"locationInModule": {
|
|
11964
11964
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11965
|
-
"line":
|
|
11965
|
+
"line": 52
|
|
11966
11966
|
},
|
|
11967
11967
|
"name": "distribution",
|
|
11968
11968
|
"optional": true,
|
|
@@ -11979,7 +11979,7 @@
|
|
|
11979
11979
|
"immutable": true,
|
|
11980
11980
|
"locationInModule": {
|
|
11981
11981
|
"filename": "src/root-constructs/nextjs-global-functions.ts",
|
|
11982
|
-
"line":
|
|
11982
|
+
"line": 56
|
|
11983
11983
|
},
|
|
11984
11984
|
"name": "overrides",
|
|
11985
11985
|
"optional": true,
|
|
@@ -19554,6 +19554,6 @@
|
|
|
19554
19554
|
"symbolId": "src/nextjs-build/nextjs-build:PublicDirEntry"
|
|
19555
19555
|
}
|
|
19556
19556
|
},
|
|
19557
|
-
"version": "0.5.
|
|
19558
|
-
"fingerprint": "
|
|
19557
|
+
"version": "0.5.15",
|
|
19558
|
+
"fingerprint": "DMoS9TQb/ztX0/p0bSS/Ug+kTveffvmQcgdonowYG90="
|
|
19559
19559
|
}
|
package/docs/caching-guide.md
CHANGED
|
@@ -409,6 +409,7 @@ When `revalidateTag("user-profile")` is called:
|
|
|
409
409
|
1. **Query DynamoDB**: Find all cache keys tagged with `pk = {buildId} and sk starts_with user-profile`
|
|
410
410
|
2. **Update Timestamps**: Mark revalidation time in DynamoDB for each cache entry
|
|
411
411
|
3. **Delete S3 Objects**: Remove corresponding cache files from S3
|
|
412
|
+
4. **Invalidate CloudFront** (`NextjsGlobalFunctions`/`NextjsGlobalContainers` only): Evict the corresponding paths from the CDN edge cache too, so the origin's now-fresh state isn't masked by a still-cached edge response. This is best-effort and asynchronous (`cloudfront:CreateInvalidation` has no bounded completion SLA), so a client may briefly still observe stale content immediately after revalidation.
|
|
412
413
|
|
|
413
414
|
**Revalidation Safety**: Even if S3 deletions fail due to network issues or race conditions, the cache handler will detect stale data during the next `get()` operation by comparing timestamps and automatically remove invalid entries.
|
|
414
415
|
|
|
@@ -428,6 +429,8 @@ For routes with time-based revalidation (e.g., `revalidate: 3600`):
|
|
|
428
429
|
- Triggers background regeneration when expired
|
|
429
430
|
- Updates cache files in S3 automatically
|
|
430
431
|
|
|
432
|
+
**Known limitation on Lambda**: this background regeneration is Next.js's own fire-and-forget work, not something cdk-nextjs's cache handler is invoked to await — the same "no signal for when background work is complete" gap that led to `NextjsRevalidation` (an SQS-based workaround) being removed in favor of waiting for Next.js's [Deployment Adapters `waitFor` API](https://github.com/vercel/next.js/discussions/77740) (see `docs/breaking-changes.md` 0.4.0). Until cdk-nextjs adopts `waitFor`, time-based revalidation on Lambda may occasionally not complete before the execution environment spins down, unrelated to the CloudFront-edge-cache invalidation described below (which only fires for explicit tag/path revalidation, not time-based expiry).
|
|
433
|
+
|
|
431
434
|
### Tag-based Revalidation
|
|
432
435
|
|
|
433
436
|
```typescript
|