Environment variable not being injected into container
adelanke75
HOBBYOP

9 days ago

Details:

  • Service: godly-match
  • Variable: FIREBASE_ENABLED
  • Issue: Variable is set to true in the Railway dashboard, but the container receives an empty string
  • Tested with unique value enabled_test_12345 — still came through empty
  • Code correctly reads os.Getenv("FIREBASE_ENABLED") in Go
  • Logs show: FIREBASE_ENABLED env var = '' despite dashboard showing true
  • Affects: Firebase/FCM initialization
Solved$10 Bounty

2 Replies

Status changed to Open Railway 9 days ago


The first thing (and easiest) is to check whether the variable change was deployed to the running container. That trips me up too.

Railway variables are available to the running service deployment, but the docs also say that adding, updating, or removing variables creates staged changes that must be reviewed and deployed before they apply. So the dashboard can show the value while the currently running deployment is still using an older snapshot.

I would check this in order:

1. Open the `godly-match` service.

2. Go to the service's `Variables` tab and confirm `FIREBASE_ENABLED` is defined on that service, not only on another service or environment.

3. Check whether Railway shows staged changes. If it does, deploy/apply them.

4. Trigger a fresh redeploy of `godly-match`.

5. In the new deploy logs, print only presence/value for this non-secret test variable:

log.Printf("FIREBASE_ENABLED present=%t value=%q", os.Getenv("FIREBASE_ENABLED") != "", os.Getenv("FIREBASE_ENABLED"))

6. Make sure you are checking the same Railway environment where the variable was set, for example production vs preview.

If `enabled_test_12345` is defined on the correct service/environment, the staged changes are deployed, and a fresh deployment still receives an empty string, this likely needs Railway staff to inspect the deployment snapshot for `godly-match`.

Docs:

- https://docs.railway.com/variables

- https://docs.railway.com/variables/reference


Status changed to Awaiting User Response Railway 9 days ago


adelanke75
HOBBYOP

8 days ago

i had to

// change this:

enabled = os.Getenv("FIREBASE_ENABLED") == "true"

// to this temporarily:

enabled = true


Status changed to Awaiting Railway Response Railway 8 days ago


Status changed to Solved adelanke75 8 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...