-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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(@astrojs/netlify): Add on-demand builders Netlify functions #5874
Conversation
🦋 Changeset detectedLatest commit: 39d5035 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Very nice! Can you add a changeset? |
@matthewp There is a CI failure on macOS. It's related to a timeout in an Astro CLI test . I think this should not be impacted by this pull request. Thanks. |
@juanmiguelguerrero Yeah thanks, I believe that's a flaky test. I'll rerun. |
I found an error in the example code. This is the correct code: import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
export default defineConfig({
output: 'server',
adapter: netlify({
builders: true
}),
}); Note: I have edited the previous comment. |
@juanmiguelguerrero Here is the file that needs to be edited to add something to the docs Can you please document the necessary changes there, following the style of the other items at https://docs.astro.build/en/reference/configuration-reference/ ? Let me know if you need/want assistance with this. Then the docs team will review them! |
@sarah11918 I think there is nothing to change in that file. This code changes do not affect the general Astro configuration. They only affect the Netlify adapter configuration. The doc to update is this one: https://docs.astro.build/en/guides/integrations-guide/netlify/ In my opinion, the place to insert this change is inside the "Configuration" section, between the "dist" and "binaryMediaTypes" options. The text we should include would be something like this: buildersOn-demand Builders are serverless functions used to generate web content as needed that’s automatically cached on Netlify’s Edge CDN. To activate rendering with this type of functions, use the import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
export default defineConfig({
output: 'server',
adapter: netlify({
builders: true
}),
}); This functionality is only available whith the For more information about Netlify On-demand Builders visit the Netlify documentation. |
@juanmiguelguerrero Gotcha! In that case, you'll want to edit this page: https://github.com/withastro/astro/blob/main/packages/integrations/netlify/README.md This content is pulled into the Docs site from this README. Would you mind opening a PR with proposed changes there? Docs will get notification of that PR automatically, and that's where we can finalize the wording together. Thanks! |
@sarah11918 I have just updated the documentation. |
@matthewp Jhon, can you resolve these conflicts? @sarah11918 Have you seen the changes I made to the README? Are they correct? Can I help? Thanks... 🚀 |
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 for the ping to let me know this was updated! Here are my suggestions for documentation text, if they don't lose your original intention!
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
@matthewp I have already reviewed the pending conflicts. |
Thanks @juanmiguelguerrero! This is looking great. @sarah11918 just need your approval if there's nothing else. |
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.
Docs is happy! Thanks @juanmiguelguerrero 🙌
Netlify on-demand builders allow setting a Time to Live duration – this can be very useful for content like e-commerce or larger CMS setups. Ideally this could be configured per route ( a. |
@betabong It is an interesting functionality and is not difficult to implement. My only doubt is how would be the best configuration option? I think the simplest is something like this: import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
export default defineConfig({
output: 'server',
adapter: netlify({
builders: true,
ttl: 3600
}),
}); Anyway I would like to know before the opinion of @matthewp |
Hey @juanmiguelguerrero I have made a pull request here #6219 Please have a look, thanks 🙏 |
Changes
Testing
chai
.Docs
/cc @withastro/maintainers-docs for feedback!