9 months ago
Hello Railway Support,
I'm experiencing a critical issue: environment variables I add in the “Variables” section of my project are not available at runtime inside my deployed app.
Specifically, I'm using os.getenv("OPENAI_API_KEY") in Python, but print(repr(os.getenv("OPENAI_API_KEY"))) always returns None, even though the variable is correctly set in Railway under that exact name.
What I've tried:
Variable is named exactly:
OPENAI_API_KEYConfirmed it's saved and visible in Railway UI
No
.envfile is present in the repoNo
load_dotenv()call in the codeRedeployed the project manually multiple times
Still, the variable is not available at runtime.
This breaks my integration with OpenAI Assistants API.
Could you please help me verify why the environment variable is not reaching the runtime container?
Thanks in advance!
1 Replies
9 months ago
Hi arthur,
You need to click the deploy button to make the staged changes to your variables available in the environment.
Best,
Railway Support
Status changed to Awaiting User Response Railway • 9 months ago
7 months ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 7 months ago