Environment variables not setting up

image
This is my ormconfig, locally everything works great if i change NODE_ENV variables i connect to my docker database or database created on render, however if i deploy my backend on render and i try to connect to the database which is also on render im getting error that i cant connect to db, which looks like .ENV variables are not read properly because when i hard code url not with env value but with the value hardcoded from render database then i can connect to it. my environment variables that are set up on render are like this NODE_ENV=“value from render database internal or external database url” i tried both, external and internal database url, and other environemnt variables are not read properly too

Is there a difference if in my local repo i have NODE_ENV=production and in render i set NODE_ENV=production or “production” does it matter?

Hi,

What’s the actual error you’re seeing?

There will always be differences between environments: development mode/Local, production mode/Render, etc. These differences need to be considered and configured as required for your own app in each environment.

Some things to consider:

  • Any new/edited environment variables are only available to the runtime instance after a successful deploy.
  • Render sets NODE_ENV automatically on the Node Native Runtime: https://docs.render.com/environment-variables#node
  • Environment variable keys are case-sensitive.
  • If using the Render environment variables (not a secret file/.env) don’t wrap values in quotes.

Alan

Hi, Alan. no matter what variable i set it is not read. for example i set environemnt variable DATABASE_EXTERNAL_URL to the specific value and rebuild my server and i cant connect to the database , however if i hard code this value in my project and im not using env variable i can connect to it. it is not a problem with values because everything works great on localhost

Please could you share some specific details of the issue you are experiencing that may help us troubleshoot it with you, e.g. any logs/errors/output, service name/ID, reproduction steps, etc.

If you don’t want to share these details on the community forum, please feel free to raise a ticket from the “Help” or “Contact Support” links while logged into the Dashboard.

Alan