Env vars visible in startup logs but undefined when handling requests — possible split process/container
valenaristi06-alt
HOBBYOP

an hour ago

Project: awake-transformation, service: daxos, environment: production.

My service variables are configured correctly in the dashboard, and the

startup log confirms they are present in the process:

[startup] ANTHROPIC_API_KEY present: true | length: 108

But when an HTTP request is handled, the same variable is undefined. I have

tried: service variables, shared variables, capturing the value at boot into

a module constant, storing it in globalThis, storing it in the database, and

writing a config file directly via the Railway console (the file exists when

I cat it, but the request handler cannot read it).

All five approaches fail identically. This strongly suggests the process

serving HTTP requests is not the same process that boots and writes the logs,

or that the console attaches to a different container than the one serving

traffic.

The service runs a single "node src/server.js" with 1 replica, no cluster,

no forking.

What configuration would cause this?

$10 Bounty

1 Replies

Railway
BOT

an hour ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway about 1 hour ago


34 minutes ago

Try log the whole environment variables inside the request handler and see if ANTHROPIC_API_KEY is appear among another variables


Welcome!

Sign in to your Railway account to join the conversation.

Loading...