Variable not recognized in code
andremaytorena
PROOP

a month ago

Hi, I added a new variable:

WORKER_REDIS_URL="${{worker-redis.REDIS_URL}}"

However when I try to access it:

import os
        from celery import Celery

        # Find all REDIS env vars for debugging
        redis_vars = {k: v[:30] + "..." for k, v in os.environ.items() if "REDIS" in k.upper()}
        SlackNotifier().send("Shopify alert dispatch - env check", level="info", extra={
            "tenant_host": tenant_host,
            "user_id": user_id,
            "redis_env_vars": redis_vars,
        })

        broker = os.getenv("W_REDIS_URL")
        if not broker:
            SlackNotifier().send("W_REDIS_URL not set — falling back to FBA_REDIS_URL", level="warn")
            return

        client = Celery(broker=broker)
        result = client.send_task("tasks.send_shopify_integration_alert", args=[tenant_host, user_id])```

It says it's not present (already redeployed like 20 times), when I printed all the variables containing REDIS it just showed this:
```{
  "tenant_host": "urvadevelopments.com",
  "user_id": "cus_KWy5OcF7M8bY",
  "redis_env_vars": {
    "REDIS_URL": "redis://default:LrqDLCVktOnYyo..."
  }
}```

19 Replies

andremaytorena
PROOP

a month ago

Even tried changing the name and nothing

Screenshot_2026-04-14_at_15.50.17.png

Attachments


andremaytorena
PROOP

a month ago

Screenshot_2026-04-14_at_15.50.43.png

Attachments


andremaytorena
PROOP

a month ago

Screenshot_2026-04-14_at_15.51.00.png

Attachments


andremaytorena
PROOP

a month ago

When I view the variable in railway the REDIS URL is correct, not null


andremaytorena
PROOP

a month ago

I've never had this issue before so not too sure what could be happening


andremaytorena
PROOP

a month ago

We've got a bunch of variables, they all work fine


polalalar
FREE

a month ago

You say you've added the variable WORKER_REDIS_URL, but are trying to get the variable W_REDIS_URL, could that be the issue?


andremaytorena
PROOP

a month ago

No


andremaytorena
PROOP

a month ago

I already tried WORKER_REDIS_URL


andremaytorena
PROOP

a month ago

I then changed it to another name to see if it was just a naming issue for some odd reason


andremaytorena
PROOP

a month ago

You can see the images above, right now they're set as W_REDIS_URL


polalalar
FREE

a month ago

Only thing i can come up with is checking if the variable name is the same within your code as the environment ones, otherwise i have no clue...


andremaytorena
PROOP

a month ago

Yeah but as I showed above, even when I print out the variables containing REDIS it does not appear


andremaytorena
PROOP

a month ago

So something's wrong here


jaan-mustafa
FREE

a month ago

hey i was also facing variable issue , then got to know it's taking more time to save and reflect changes


jaan-mustafa
FREE

a month ago

i discussed this in infra-discussion


andremaytorena
PROOP

a month ago

different issue no?


andremaytorena
PROOP

a month ago

blah


andremaytorena
PROOP

a month ago

Ok now it worked, that was odd, had to add the variable to the other deployments that shared the same codebase


Welcome!

Sign in to your Railway account to join the conversation.

Loading...