-
Notifications
You must be signed in to change notification settings - Fork 491
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: add cloudflare-pages preset #210
Conversation
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Hey @DaniFoldi π Do you need help to test / finish this one? I'm currently investigating to migrate to Cloudflare pages and I require this preset. |
Hi! I started writing the docs for the preset earlier today, so it should be ready today or tomorrow - the one remaining thing after this PR will be figuring out how to give api routes the request context. |
Codecov Report
@@ Coverage Diff @@
## main #210 +/- ##
==========================================
+ Coverage 53.48% 53.57% +0.08%
==========================================
Files 54 54
Lines 3468 3494 +26
Branches 368 368
==========================================
+ Hits 1855 1872 +17
- Misses 1258 1267 +9
Partials 355 355
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@tuarrep I believe it's ready for testing, and feel free to leave any feedback on the docs as well. |
maybe later we split but currently they are categorized per vendor
|
||
const r = await nitroApp.localCall({ | ||
env, | ||
context, |
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.
FYI this currently has no effect (src). unenv only picks known keys from input (url, method, headers, host, protocol, body). But we should definitely add cf context in later changes.
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 this nice work π― I guess we might have problems with public directory handling (.output/public
) should be picked. Nuxt used top level dist/
which is probably if you tested and working. We could do the same btw with preset. Will have to try on nitro-edge.
does this mean by adding ./server/api/function.js and with git integration the preset will be auto set as cloudflare_pages, and the /function directory will be created with the function.js api? I have tested it here, and while the function folder is created, no function is actually deployed on cloudflare network . Tried running CF_PAGES=1 npm run generate in this stackblitz terminal https://stackblitz.com/edit/github-dxg5qg?file=server%2Fapi%2Fcustomer.get.js Updated : Changed cloudflare build settings to |
Seeing same issue with non-get requests returning 405 |
π Linked issue
#196
β Type of change
π Description
Related to discussions #110 #196, a few in nuxt/framework
This PR intends to add a preset for Cloudflare Pages Functions - which is currently in Open Beta. Docs can be found at https://developers.cloudflare.com/pages/platform/functions/ .
Pages Functions are based on the
modules
worker type, so a different deployment preset will be needed.update since first drafted, removed no longer relevant beta warnings
Functions are still in beta, however Direct Upload is now available for Pages, and I fixed all the issues I could find.
update again
Docs have now been updated (feedback welcome), the newest version of std-env should allow for automatic detection (only via git integration).
Have a good day.
π Checklist