The new process.env support in Cloudflare workers does not work properly

For Workers & Pages, what is the name of the domain?

What is the error message?

process.env is {}

What is the issue or error you’re encountering

Not able to use process.env even after adding nodejs_compat_populate_process_env

What steps have you taken to resolve the issue?

Re-read Access your Worker's environment variables from process.env | Cloudflare Docs
Re-read docs change Adds changelog and flag information for process.env population (#20642) · cloudflare/cloudflare-docs@dc4ef68 · GitHub
Verified that repo has latest versions of wrangler, which should have merged in the nodejs_compat_populate_process_env change from workersd
Created simple repro to confirm that issue is not related to my application.

What are the steps to reproduce the issue?

npm create cloudflare@latest
├ In which directory do you want to create your application?
│ dir ./repro-process-env

├ What would you like to start with?
│ category Framework Starter

├ Which development framework do you want to use?
│ framework React

├ Select your deployment platform
│ platform Workers with Assets (BETA)

├ Select a variant:
│ variant TypeScript + SWC

├ Continue with React via npx [email protected] repro-process-env --template react-swc-ts

Add nodejs_compat_populate_process_env and attempt to use env var:

npm run dev

Verify that process.env is not populated.

Screenshot of the error

1 Like

Worth mentioning that both my original repo and repro repo were created after the launch post (2025-03-11)

Adding to wrangler doesn’t work either - Add var to wrangler as well · raghavsethi/repro-process-env@320feda · GitHub