Service Variables not available in Node.js app / process.env returns undefined

recompany9401
HOBBY

5 days ago

Hello,
I'm experiencing a persistent problem where all Service Variables defined in my Railway service are not available to my Node.js application (process.env).
Even when I add a new variable (e.g. DEMO_VAR) directly to the Service Variables (not Shared Variables), it still shows as undefined in my app.

Here is what I have tried:

  • Deleted and recreated the service from scratch.

  • Entered variables directly in the Service Variables (not using shared references).

  • Used the Raw Editor to double-check the variable names and values.

  • Fully redeployed/restarted the service after any change.

  • Printed out the entire process.env in my code; only system/default Railway variables show up, but none of my custom variables (ADMIN_USERNAME, ADMIN_PASSWORD, DEMO_VAR, etc).

  • Minimal test variable like DEMO_VAR=hello is still undefined.

Awaiting User Response

5 Replies

chandrika
EMPLOYEE

5 days ago

Hi there, can you link to the service you are having this issue with? Is this only happening in that one project and only in Node and working with other services / applications?


Status changed to Awaiting User Response railway[bot] 5 days ago


muratyildirim24
FREE

3 days ago

hi
i also have the same situation
i can not access variables from node.js with process.env
code returns "undefined"

can you help ?


Status changed to Awaiting Railway Response railway[bot] 3 days ago


chandrika

Hi there, can you link to the service you are having this issue with? Is this only happening in that one project and only in Node and working with other services / applications?

recompany9401
HOBBY

2 days ago

Hi,

I just checked and the environment variables work perfectly on my other project (“glorious-learning” / fair-project-backend-production.up.railway.app).

The problem only happens with my project “supportive-tenderness” (koad-backend-production.up.railway.app), where all custom environment variables are undefined in my Node.js app, despite using the same process as my other project.

Please help me find out why variables don’t work on this project!

Thank you.


muratyildirim24
FREE

2 days ago

i recreated the same project with builder: Railpack finally i can access the variables


muratyildirim24

i recreated the same project with builder: Railpack finally i can access the variables

parmstar
EMPLOYEE

a day ago

wonderful! Good to know. Thanks!


Status changed to Awaiting User Response railway[bot] 1 day ago