-
Notifications
You must be signed in to change notification settings - Fork 507
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(netlify): experimental support v2 functions ISR via targeted cache-control headers #2406
Merged
pi0
merged 10 commits into
nitrojs:main
from
serhalp:serhalp/fra-356-update-nitro-to-use-v2-functions
May 7, 2024
Merged
feat(netlify): experimental support v2 functions ISR via targeted cache-control headers #2406
pi0
merged 10 commits into
nitrojs:main
from
serhalp:serhalp/fra-356-update-nitro-to-use-v2-functions
May 7, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pi0
reviewed
May 1, 2024
8 tasks
pi0
changed the title
feat(netlify): use "v2" Netlify Functions and re-implement ISR via targeted cache-control headers
feat(netlify): use v3 functions and re-implement isr via targeted cache-control headers
May 1, 2024
pi0
changed the title
feat(netlify): use v3 functions and re-implement isr via targeted cache-control headers
feat(netlify): use v2 functions and re-implement isr via targeted cache-control headers
May 1, 2024
Previously, ISR in Nitro had been implemented on Netlify via its proprietary [On-Demand Builders](https://docs.netlify.com/configure-builds/on-demand-builders/) platform primitive. Now that there's momentum around [Targeted HTTP Cache Control](https://httpwg.org/specs/rfc9213.html) and that [Netlify supports it](https://docs.netlify.com/platform/caching/#supported-cache-control-headers), we can implement ISR in Nitro via these simple, standard HTTP headers instead. By virtue of switching to the standard Netlify Functions interface, this also happens to: - allow streaming responses - add better support for "hybrid rendering", e.g. if you set `prerender: true` on a specific route, that will actually work as intended now - remove the imposed 60s delay after a background generation request before which the new response will be served for subsequent requests (this was an ODB limitation) - fix a bug where we were setting `set-cookie: undefined` on responses - remove usage of an undocumented `functions-internal/server.json` Netlify config file - ... which wasn't working when using `netlify dev` in local development anyway This also configures a human-friendly name and some metadata on the function. Supersedes nitrojs#1823. Closes nitrojs#1842. Closes nitrojs#1938.
pi0
force-pushed
the
serhalp/fra-356-update-nitro-to-use-v2-functions
branch
from
May 1, 2024 15:31
2fc17ff
to
2c106d9
Compare
Rigo-m
reviewed
May 1, 2024
Super @serhalp π |
pi0
force-pushed
the
serhalp/fra-356-update-nitro-to-use-v2-functions
branch
from
May 1, 2024 16:01
1754331
to
5f02fea
Compare
pi0
changed the title
feat(netlify): use v2 functions and re-implement isr via targeted cache-control headers
feat(netlify): support v2 functions (opt-in) and re-implement isr via targeted cache-control headers
May 1, 2024
pi0
changed the title
feat(netlify): support v2 functions (opt-in) and re-implement isr via targeted cache-control headers
feat(netlify): experimental support v2 functions ISR via targeted cache-control headers
May 7, 2024
pi0
approved these changes
May 7, 2024
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.
Thanks! Merging as is mainly to allow experimenting on main branch and do pre-release refactors.
The confusing v1/v2 scheme that I added to list commits will be removed likely before releasing next versions.
8 tasks
Closed
8 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π Linked issue
Supersedes #1823.
Closes #1842.
Closes #1938.
β Type of change
π Description
Netlify introduced a new Functions interface last year. This updates Nitro to use this interface.
Previously, ISR in Nitro had been implemented on Netlify via its proprietary On-Demand Builders platform primitive, which only supports "v1" Functions. Now that there's momentum around Targeted HTTP Cache Control and that Netlify supports it, we can implement ISR in Nitro via these simple, standard HTTP headers instead.
By virtue of switching to the standard Netlify Functions interface, this also happens to:
prerender: true
on a specific route, that will actually work as intended nowset-cookie: undefined
on responsesfunctions-internal/server.json
Netlify config filenetlify dev
in local development anywayThis also configures a human-friendly name and some metadata on the function.
Note: I removed the
netlify_builder
preset, since there's no reason to use this anymore. I'm not even sure why it was ever exposed as a preset. I did this as a separate commit, so if you consider this a breaking change I can pull it out into a separate PR.π Checklist