Missing environment variable
What is this error?
Your code asked for a configuration value by name and got nothing back. It works on your machine because your local .env file has it; the server you deployed to does not.
Common Causes
- The variable was never added in the hosting dashboard.
- It was added but the project was not redeployed afterwards.
- The name is spelled differently (case matters).
- It is a client-side variable missing the required public prefix (VITE_, NEXT_PUBLIC_...).
How to fix it (Check First)
- 1Open the hosting dashboard → Environment Variables and read the exact names.
- 2Compare them character by character with your .env file.
- 3Trigger a fresh deployment after adding anything.
What NOT to do
- Do not paste the secret directly into your source code to 'make it work'.
- Do not rewrite the component — the component is fine.
Technical Details
Environment variables are injected into the process at build or runtime by the platform. Client bundles only receive variables that carry the framework's public prefix, because everything in a client bundle is readable by anyone.