-
Notifications
You must be signed in to change notification settings - Fork 87
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: use Netlify Durable Cache #2510
feat: use Netlify Durable Cache #2510
Conversation
📊 Package size report 0%↑
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
75a601e
to
d75a484
Compare
d75a484
to
7c125cb
Compare
7c125cb
to
4bd24ff
Compare
tests/e2e/simple-app.test.ts
Outdated
expect(headers['cache-status']).toBe('"Next.js"; hit\n"Netlify Edge"; fwd=miss') | ||
expect(headers['cache-status']).toBe( | ||
'"Next.js"; hit\n"Netlify Durable"; fwd=miss\n"Netlify Edge"; fwd=miss', | ||
) |
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.
duplicated from #2527 to unblock myself
@@ -322,6 +322,9 @@ export async function uploadBlobs(ctx: FixtureTestContext, blobsDir: string) { | |||
) | |||
} | |||
|
|||
const DEFAULT_FLAGS = { | |||
serverless_functions_nextjs_durable_cache_disable: true, |
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.
Since I implemented the flag logic to treat a nullish flag as false
(i.e. don't disable Durable Caching, so that we can actually archive the feature flag someday), dozens of integration tests (which were implicitly mocking runtime context.flags
to be empty) started failing. This change fixes that, by opting those out of the flag for now.
This is gated behind a feature flag for now. I can't link to any public docs yet, but by the time you're reading this you should be able to find a section on "Durable caching" at https://docs.netlify.com.
4bd24ff
to
85a5284
Compare
Description
👁️🗨️ This will be easier to review commit by commit:
durable
cache-control directive if feature flag is enabled for requestThis is gated behind a feature flag for now.
I can't link to any public docs yet, but by the time you're reading this you should be able to find a section on "Durable caching" at https://docs.netlify.com.
Documentation
This functionality is now documented at https://docs.netlify.com/platform/caching/#durable-directive.
Tests
This PR adds exhaustive unit tests and an e2e integration test deployed to a site with the feature flags enabled. I opted not to test through to the platform behavior here since there's no real way to guarantee you're actually hitting separate CDN nodes on subsequent requests and I'd rather not write tests that don't provide confidence in the behavior under test.
You can also manually deploy to that site and manually verify the expected behavior, which I've done.
You can also use this demo site I created: https://github.com/serhalp/next.js-netlify-durable-cache-demo.
Relevant links (GitHub issues, etc.) or a picture of cute animal
FRP-749
Supersedes #2502.