Open MickL opened 6 months ago
Do you call runtimeConfig(event)
inside an event handler? Due to how late cloudflare provides environment (during request) it is a limitation.
I do not. It works with the example above so in nuxt/nitro config the process env is there?
See also https://github.com/Atinux/nuxt-env-repro which gives this output (called from inside an event handler):
{
"runtimeConfig().hello": "",
"runtimeConfig(event).hello": "world",
"process.env.NUXT_HELLO": "world"
}
might be you want to ensure NITRO_
env vars are passed to runtimeConfig by reassign them on request
hook.
i'm facing only my env vars are passed to runtimeConfig.
and i reassign them to ensure they are all passed and voila, they are there all inside runtimeConfig.
reference https://github.com/nitrojs/nitro/pull/2575#issuecomment-2480455926
Environment
nitropack: 2.9.6
Reproduction
-
Describe the bug
Environment variables dont seem to work on Cloudflare:
This works locally with .env:
But deployed to Cloudflare with the environment set in Cloudflare Dashboard it stays empty. Using the following workaround it works:
But what would then the purpose of defining
NITRO_
env vars in the first place when they are not auto "injected"?Additional context
No response
Logs
No response