Environment Variables Not Visible in Service - Gemini API and Telegram Bot API
alex63656
HOBBYOP

4 months ago

Issue Description:

I have deployed a web service on Railway that runs both a backend (Node.js) and a Telegram bot concurrently. The service has been configured with environment variables in the Variables tab, specifically:

- GEMINI_API_KEY (for Gemini API)

- TELEGRAM_BOT_TOKEN (for Telegram Bot API)

However, when I check the service logs and application runtime, these environment variables are not being recognized by the application. The service tries to access these variables but returns undefined.

What I've verified:

- Variables are visible in the Railway dashboard Variables section

- The service is using a custom start script with concurrent execution

- The deployment shows as successful (ACTIVE status)

- GitHub repository is properly connected and recent commit was deployed

Error patterns:

- Application cannot initialize Gemini API client (missing API key)

- Telegram bot fails to connect (missing bot token)

Steps taken:

- Verified variables are set in the Variables tab

- Redeployed the service

- Checked the recent deployment logs

Could you help me troubleshoot why the environment variables are not being passed to the running service?

Solved

3 Replies

Railway
BOT

4 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


Hey Alex,

QQ: Are you usinga Dockefile for your application?


Status changed to Awaiting User Response Railway 4 months ago


alex63656
HOBBYOP

3 months ago

Hi Angelo,

Thanks for your help! I found the issue - it was my inexperience with Railway. I added the environment variables but forgot to click "Apply" and then "Deploy" to make the changes take effect. The variables were just sitting in draft mode and weren't actually deployed to the service.

Everything is working now after I applied and deployed the changes. Appreciate your assistance!


Status changed to Awaiting Railway Response Railway 4 months ago


Status changed to Solved brody 4 months ago


Loading...