Where are cloudflare pages environment variables attached? #2985
targetlucked69
started this conversation in
General
Replies: 2 comments 1 reply
-
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.
0 replies
-
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.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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