#How do we access production env vars and secrets with the vite-plugin?

3 messages · Page 1 of 1 (latest)

tame spindle
kindred moss
#

Did you check the env object (second parameter in your fetch() callback in your worker)?

At least when building a regular worker env vars and secrets are in there.

export default {
  async fetch(_request, env) {
    //const myEnv = env.CLOUDFLARE_SECRET;
    return new Response(JSON.stringify({ ... env }))
  },
},