Where are cloudflare pages environment variables attached? #2985
targetlucked69
started this conversation in
General
Replies: 2 comments 3 replies
-
You can access the CF env variables inside event context: import { getContext } from 'vinxi/http'
// below should be called inside an `eventHandler`
const cf = getContext('cloudflare')
console.log(cf.env.MY_KEY) |
Beta Was this translation helpful? Give feedback.
1 reply
-
I'm a bit confused here, if I understand correctly nitro is the production server, so reading through the nitro documentation, nitro should allow us to use import.meta.env universally or am I missing something? https://nitro.build/deploy/providers/cloudflare#environment-variables |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a file and when I log
process.env.MY_KEY
orimport.meta.env.MY_KEY
, it is undefined. I'm calling it inside a page like this:and here's my
wrangler.toml
fileand my
app.config.ts
This works with other deployments btw, just wrangler and deployment to CF pages.
How do I get access to env variables?
Beta Was this translation helpful? Give feedback.
All reactions