Skip to content
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

fix: generate wrangler.toml in CF deployment to use bindings #63

Merged
merged 14 commits into from
Apr 11, 2024

Conversation

farnabaz
Copy link
Collaborator

No description provided.

Copy link

cloudflare-workers-and-pages bot commented Apr 10, 2024

Deploying nuxthub-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 51bb1fa
Status: ✅  Deploy successful!
Preview URL: https://0dc6f05e.nuxthub-module.pages.dev
Branch Preview URL: https://feat-wrangler-toml.nuxthub-module.pages.dev

View logs

@pi0
Copy link

pi0 commented Apr 10, 2024

this is definitely conflicting with nitro in the future... :(

@atinux
Copy link
Contributor

atinux commented Apr 10, 2024

Following our call with @pi0 about the best way forward and his work on nitrojs/nitro#2353 (thank you!)

The NuxtHub API should send back a wrangler in a JSON format as Nitro uses confbox to generate the wrangler.toml file.

Instead of generating the wrangler.toml file ourselves, we can directly set it:

nuxt.options.nitro.cloudflare.wrangler = defu(wranglerConfigFromNuxtHub, nuxt.options.nitro.cloudflare.wrangler)

So far Cloudflare Pages CI is reading from the rootDir to update the final configuration before deploying, so we need to tell Nitro to generate the output in another directory (see those lines)

Also, I am not sure that we should have the wrangler.configPath (as it will be generated in the wrangler.toml) so I suggest:

nitro.cloudflare.wranglerPath // default to join(nitro.options.rootDir, 'wrangler.toml')
nitro.cloudflare.wranglerOutputPath // default to join(nitro.options.output.publicDir, 'wrangler.toml')

@farnabaz farnabaz changed the title WIP fix: generate wrangler.toml in CF deployment to use bindings fix: generate wrangler.toml in CF deployment to use bindings Apr 11, 2024
@atinux atinux merged commit 1c39ecd into main Apr 11, 2024
5 checks passed
@atinux atinux deleted the feat/wrangler.toml branch April 11, 2024 17:07
Aslemammad pushed a commit to Aslemammad/nuxt-core that referenced this pull request Jun 12, 2024
…hub#63)

* fix: generate `wrangler.toml` in CF deployment to use bindings

* up

* fix: environment variables

* up

* up

* chore: update to use wrangler object

* chore: use nitropack-nightly

* fix: await bundling for openapi

* cohre: add todo

* fix: warn and exit when changes detected in bindings

* fix: remove nitro nightly

* chore: up

* Update src/runtime/server/api/_hub/openapi.get.ts

* Update src/utils.ts

---------

Co-authored-by: Sébastien Chopin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants