Cloudflare: Environment variables starting with `NITRO_` are not passed to runtimeConfig
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 899
- Avg merge
- 2d 24m
- Merged PRs (30d)
- 40
Description
Environment
nitropack: 2.9.6
Reproduction
Describe the bug
Environment variables dont seem to work on Cloudflare:
export default defineNitroConfig({
runtimeConfig: {
myVar: ''
},
});
This works locally with .env:
NITRO_MY_VAR="Hello world"
But deployed to Cloudflare with the environment set in Cloudflare Dashboard it stays empty. Using the following workaround it works:
runtimeConfig: {
myVar: process.env.NITRO_MY_VAR,
},
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from defineNitroConfig runtimeConfig handling and compare local .env loading with process.env.NITRO_MY_VAR when deployed to Cloudflare. Reproduce with nitropack 2.9.6 and a dashboard-defined NITRO_MY_VAR; done means the runtimeConfig value is populated without the workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100