[Nuxt] Unable to load env vars when nodejs_compat flag enabled

For my Nuxt3 app on CF Pages, if I enable the nodejs_compat flag, the environment variables returned from useRuntimeConfig do not return the correct values. (compatibility date 2024-09-27) The correct values are the ones I set in my cloudflare project dashboard. Instead I am getting the default values as defined in my nuxt.config.ts file. Here is an issue I made describing the issue in more detail: https://github.com/nuxt/nuxt/issues/29188 Deployed website: https://useruntimeconfig-repro.pages.dev/ Repo Nuxt Config: https://github.com/Amar-Gill/useruntimeconfig-repro/blob/main/nuxt.config.ts So when visiting the site, I expect to see: client side env var: testing-public-env-var server side env var: this-is-a-test-value Instead I see default values: client side env var: xyzabc server side env var: abc123
GitHub
[cloudflare pages] environment variables not loaded with nodejs_com...
Environment Operating System: Darwin Node Version: v20.10.0 Nuxt Version: 3.13.2 CLI Version: 3.14.0 Nitro Version: 2.9.7 Package Manager: [email protected] Builder: - User Config: - Runtime Modules: - B...
3 Replies
cosbgn
cosbgn2mo ago
It's a known issue. I don't think you can do much: https://discord.com/channels/595317990191398933/1288937653537869979
AGill
AGillOP2mo ago
I see thanks for sharing. Unfortunately I'm stuck waiting because I need nodejs_compat_v2 (or nodejs_compat + compatibility_date > 2024-09-23) since I want to use the Browser rendering API.
AGill
AGillOP2mo ago
Cloudflare Docs
Wrangler | Browser Rendering docs
Wrangler is a command-line tool for building with Cloudflare developer products.
Want results from more Discord servers?
Add your server