Environment variable seems to be cached or not updating

connect-ys
PRO

a month ago

Hello, I'm facing a persistent issue where one of my environment variables (ELEVENLABS_API_KEY) is causing a 401 Unauthorized error when my Node.js application tries to use it.

I have 100% confirmed that:

  1. The API key value is correct (it works perfectly in a local test script on my machine).

  2. The application code correctly reads the variable using process.env.ELEVENLABS_API_KEY.

  3. I have tried deleting the variable, redeploying, re-adding the variable, and redeploying again, but the issue persists.

It seems like the old/invalid value is cached somewhere on the platform and is not being updated for my deployment.

Can you please help me check if there's a caching issue on your end for my project's environment variables?

Solved$10 Bounty

10 Replies

Railway
BOT

a month 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!


Railway

Hey there! We've found the following might help you get unblocked faster: - [๐Ÿ“š Railway vs. VPS Hosting](https://docs.railway.com/maturity/compare-to-vps) - [๐Ÿงต Env Vars and index.ts Not Updating After Deploy](https://station.railway.com/questions/env-vars-and-index-ts-not-updating-after-7e437b63) - [๐Ÿงต Python script can't load env variables from Railway](https://station.railway.com/questions/python-script-can-t-load-env-variables-f-659ea989) If you find the answer from one of these, please let us know by solving the thread!

connect-ys
PRO

a month ago

I've tried the second solution ( Env Vars and index.ts Not Updating After Deploy ) and it unfortunately doesn't work.


a month ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody โ€ข about 1 month ago


a month ago

Silly question but this happens more often than you might think, did you deploy the changes after changing the variable and or redeploy the downstream services if this is a shared variable


dev

Silly question but this happens more often than you might think, did you deploy the changes after changing the variable and or redeploy the downstream services if this is a shared variable

connect-ys
PRO

a month ago

Hey, yep I've already did it multiple times, and even as I'm writing this down, I did it 5min ago.


a month ago

Hey there! In the part of your script that references this variable, are you able to print that to your logs and validate that this matches your working value?
Unsure if you have already checked this but would like to validate that its actually a value desync.


noahd

Hey there! In the part of your script that references this variable, are you able to print that to your logs and validate that this matches your working value? Unsure if you have already checked this but would like to validate that its actually a value desync.

connect-ys
PRO

a month ago

Hey, sorry for the late answer, here it is This is weird, cause like the variable is being read correctly by Railway but when he sends it back to ElevenLabs API, it just sends back an error. And the key is correct too on ElevenLabs, it's the same one.


a month ago

Are you using ElevenLabs HTTP API or some sort of SDK? Can you show us where you read and then use the variable? Maybe it'll give us some hints as to what is going on


dev

Are you using ElevenLabs HTTP API or some sort of SDK? Can you show us where you read and then use the variable? Maybe it'll give us some hints as to what is going on

connect-ys
PRO

a month ago

I'm using ElevenLabs HTTP API, I'll give you some screenshots of the file where I use it


fra
HOBBYTop 10% Contributor

a month ago

do you have any ip restriction in elevenlabs?


connect-ys
PRO

a month ago

Hey everyone, I've just found out the solution : my problem was that the variable for the Voice ID wasn't correct lmao so it just kept putting an error everytime the API key was being sent.

I'm sorry for losing everyone time on such small problems.


Status changed to Solved chandrika โ€ข about 1 month ago


Loading...
Environment variable seems to be cached or not updating - Railway Help Station