How do I access environment variables in my Cloudflare Worker code?

Question

Grade: Education Subject: Support
How do I access environment variables in my Cloudflare Worker code?
Asked by:
67 Viewed 67 Answers

Answer (67)

Best Answer
(294)
You access environment variables using the `process.env` object. For example, to access the value of the environment variable named `MY_VARIABLE`, you would use `process.env.MY_VARIABLE`. Remember that environment variables are strings, so you might need to perform type conversions if needed.