Node.js reads environment variables when the application process starts. Changing environment variables in cPanel doesn't necessarily update values inside an already-running process.
Here are some things to check:
- Confirm that the variables are saved in the correct Node.js application configuration.
- Check for spelling mistakes in variable names.
- Make sure your application isn't overriding server variables with values from a
.env file.
- Restart the application after changing its environment configuration.
- Verify that the application is reading the expected variable names.
You can safely check whether a variable exists without exposing its actual value:
console.log({
databaseConfigured: !!process.env.DB_NAME,
apiKeyConfigured: !!process.env.API_KEY
});
Never print actual database passwords, API keys, or other secrets in production logs.