New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lambda-at-edge, nextjs-component, s3-static-assets): support ver… #803
Conversation
…sioned static pages/next data for proper fallback SSG generation, never cache fallback pages
Codecov Report
@@ Coverage Diff @@
## master #803 +/- ##
==========================================
+ Coverage 80.23% 80.54% +0.30%
==========================================
Files 57 57
Lines 1862 1912 +50
Branches 410 422 +12
==========================================
+ Hits 1494 1540 +46
- Misses 310 313 +3
- Partials 58 59 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
…sioned static pages (currently only next data is versioned) for proper fallback SSG generation, never cache fallback pages
static-pages/build1
,static-pages/build2
. It also copies theBUILD_ID
file toassets/BUILD_ID
orassets/basepath/BUILD_ID
to represent the current latest version that was just uploaded to S3.BUILD_ID
file is present in S3, it uses it and the AWS S3 SDK to clear all previous build versions of_next/data/<build_id>
andstatic-pages/<build_id>
except the version inBUILD_ID
. It doesn't remove existing pages in the rootstatic-pages
directory, so it won't be destructive when transitioning from old to new Lambda versions. This happens before the S3 upload of the new build version. Then once the new S3 assets are uploaded, only thenew
+previous
build versions are present. This is to help us save on S3 storage costs and ensure Lambda doesn't break on deployment transitions.static-pages/pages.html
. This never gets deleted, so subsequent deployments may be getting an old generated page for an SSG fallback. By using versioned pages instead, we can ensure that it gets updated (and old ones get cleared after deployments).no-store
) and now can also use the versioned pages properly.Tests
Updated unit and e2e tests. Added tests for new S3 removal method for both with and without basePath.