Node.js apps on Flashcloud read their environment variables from the Setup Node.js App tool in cPanel, not from a .env file sitting in your project folder. If your app reads process.env.SOMETHING and it's coming back undefined, check the app's configuration screen in cPanel first.
This is different from how most local Node.js tutorials set things up. Here's how it works on a Flashcloud account.
Setting variables in Setup Node.js App
Log into your account and open cPanel, then find Setup Node.js App under the Software section. Click into your application (or create one if you haven't yet), and add your environment variables there as name/value pairs.
Add each variable as a name/value pair: things like DATABASE_URL, API_KEY, NODE_ENV, or any config value your app expects. There's no limit on how many you add beyond what's reasonable for an app config.
Node.js reads environment variables once, at process start, into process.env. On most hosting accounts, editing them updates the stored configuration but doesn't touch a process that's already running - the app keeps using the old values until it's restarted.
Why not use a .env file
You can still ship a .env file in your project and load it with a package like dotenv if your app is built that way. But treat the cPanel environment variables panel as the source of truth for anything that changes between deploys or that you don't want committed to your repository: database credentials, API keys, secrets. A .env file sitting in your app directory is also a file that could get served or backed up alongside your code, which is a bad place for a secret to live. The cPanel panel keeps those values out of your files entirely.
If you use both cPanel's variables and a loaded .env file, decide which one wins in your app's startup code. Most setups let process.env values that are already set (from cPanel) take priority, since dotenv by default won't overwrite a variable that's already defined.
Common symptoms of a missing variable
- App crashes on startup with something like
TypeError: Cannot read properties of undefinedwhen your code doesprocess.env.DATABASE_URL.something. - App starts fine but silently falls back to defaults, connecting to the wrong database or running in the wrong mode.
- Changes you made in cPanel don't seem to take effect, because the app wasn't restarted after the edit.
Check the variable name for typos first. Node.js does exact, case-sensitive matching on process.env keys, so Database_URL and DATABASE_URL are two different, unrelated things as far as your app is concerned.
Restarting after changes
On most hosting accounts, you'll need to restart your Node.js app after you:
- Add, remove, or edit an environment variable.
- Change the Node.js version for the app.
- Update the application's startup file or entry point.
- Pull new code that reads a variable you haven't set yet.
If you deploy through cPanel's Git Version Control tool, restart the Node.js app as a separate step after the pull completes.
When to contact support
If you've set the variable, restarted the app, and it's still not showing up in process.env, open a ticket from Support in the portal. Include the app's domain, the variable name you're expecting, and what your startup logs show. A real person will check the underlying Node.js app configuration with you rather than guessing from the outside.