R
Railway2y ago
elis

Service URL ENV variable is empty

The variable for a static URL of one of the services is empty (despite having a domain associated with it) - other services (and env variables) who are dependent on it are failing. Variable name: RAILWAY_SERVICE_MPC_API_URL
67 Replies
Percy
Percy2y ago
Project ID: f568f607-e4d1-4517-ba1a-537dc9a8be86
elis
elisOP2y ago
f568f607-e4d1-4517-ba1a-537dc9a8be86
Brody
Brody2y ago
can you send a browser screenshot of your project
elis
elisOP2y ago
what kind of screenshot? railway project?
Brody
Brody2y ago
bruh full screenshot of your browser window with the railway project in question open
elis
elisOP2y ago
Brody
Brody2y ago
and what service is trying to access RAILWAY_SERVICE_MPC_API_URL
elis
elisOP2y ago
docs mention the static url env vars to be RAILWAY_{serviceName}_STATIC_URL while the env variable is actually RAILWAY_SERVICE_{serviceName}_URL
Brody
Brody2y ago
i know, i dont understand that either RAILWAY_SERVICE_MPC_API_URL would be correct
elis
elisOP2y ago
the mpc service is trying to get the RAILWAY_SERVICE_MPC_API_URL it is correct -it's just an empty string do note that it worked - but since yesterday it's reporting as empty string
Brody
Brody2y ago
okay now what exactly is the mpc service?
elis
elisOP2y ago
mpc service is a web client service (nextjs app)
Brody
Brody2y ago
can you show me how you are accessing the variable in code
elis
elisOP2y ago
note that I do have the RAILWAY_SERVICE_MPC_API_URL variable provided - it's just that it's empty string process.env.RAILWAY_SERVICE_MPC_API_URL
elis
elisOP2y ago
elis
elisOP2y ago
variable exists...
Brody
Brody2y ago
is that an .env file?
elis
elisOP2y ago
that's from the app it's a dump of the env vars
Brody
Brody2y ago
while running on railway?
elis
elisOP2y ago
the project doesn't have .env vars in the git repo
while running on railway?
yes
Brody
Brody2y ago
ssr next app?
elis
elisOP2y ago
yea next13
Brody
Brody2y ago
dont variables have to be prefixed with something? like NEXT_
elis
elisOP2y ago
mpc-api is just an express app it also has these variables also empty strings
like NEXT_
NEXT_PUBLIC_ if you want them on public e.g. front-end any env variables that are not prefixed are available on the server
Brody
Brody2y ago
im sorry i cant reproduce this https://utilities.up.railway.app/env-vars you must be overriding them or something
elis
elisOP2y ago
Overriding them? nope... they're just empty string vars i think it's a bud on railway's side...
im sorry i cant reproduce this
Yes, because it should work - but since yesterday it just doesn't bud=bug 😄
Brody
Brody2y ago
deploy an absolute bare minimun nodejs service, no framework, nothing, just index.js and package.json and inside that index.js file simply put
console.log(process.env);
console.log(process.env);
elis
elisOP2y ago
how do I see the console log after deploying?
elis
elisOP2y ago
Done vars are empty but that's because the PR env domains are empty - so it makes sense added domains for the services and rebuilding the test
elis
elisOP2y ago
now with domains set, RAILWAY env vars are still empty:
Brody
Brody2y ago
remind me, is this the first time you mentioned this being a pr environment?
elis
elisOP2y ago
it happens on non-pr envs now after rebuilding with domains set the vars aren't empty
Brody
Brody2y ago
show me the code behind these printouts please?
elis
elisOP2y ago
index.js:
console.log('process.env:', process.env)
console.log('process.env:', process.env)
scripts.start/build are both set to node index.js
Brody
Brody2y ago
can you share the repo for that?
elis
elisOP2y ago
no, sorry it's a simple nodejs with package.json and index.js as requested you mean to make a public repo with that code?
Brody
Brody2y ago
id like to see the exact code that made this output
elis
elisOP2y ago
elis
elisOP2y ago
this helps? xD
elis
elisOP2y ago
Brody
Brody2y ago
the vars arent empty?
elis
elisOP2y ago
after rebuilding - no, aren't empty filled correctly but on production env's they are empty despite having domains set
Brody
Brody2y ago
okay will flag team
elis
elisOP2y ago
🙏 thank you!
Brody
Brody2y ago
sorry it took so long to get to this point, i just had to be sure it was on railway's end
elis
elisOP2y ago
all good! looking forward for their reply
Percy
Percy2y ago
Flagging this thread. A team member will be with you shortly.
elis
elisOP2y ago
👋
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Ray
Ray2y ago
Hey! Sorry for the delay here. Can you try re-deploying the env-vars test service? I wanna see what happens under the hood
elis
elisOP2y ago
redeploying now deployment id: a7a2cd62-8cbe-4707-a5a9-acda79551715
Ray
Ray2y ago
interesting, could you try re-creating a new service for this? I'm wondering if the env vars we're picking up is stuck in a previous state prior to service creation
elis
elisOP2y ago
e.g. remove the service and add it from scratch?
Ray
Ray2y ago
yep
elis
elisOP2y ago
running you can see that for the production env all the RAILWAY_SERVICE_MPC_*_URL are empty strings staging as well if it's of any help - it seems that the auto-generated domains are correctly populated in the env vars, that is
Brody
Brody2y ago
then what isn't being populated
elis
elisOP2y ago
all the other services
elis
elisOP2y ago
elis
elisOP2y ago
redeployed - env vars for service urls are empty 😦 you can see the services (on the left) do have URLs, but the env vars echoed in app are empty...
Ray
Ray2y ago
I can confirm. Going to raise this up, thanks!
elis
elisOP2y ago
Thanks!
onurgu
onurgu2y ago
I am having this problem too
Brody
Brody2y ago
it will be looked into https://discord.com/channels/713503345364697088/1114802678015479868/1114802678015479868
RAILWAY_SERVICE_${SERVICENAME}_URL environment variable may not work for some users.
Elwin | OKX
Elwin | OKX2y ago
I am encountering the same issue here, please help to fix this.
Brody
Brody2y ago
it will be looked into https://discord.com/channels/713503345364697088/1114802678015479868/1114802678015479868
RAILWAY_SERVICE_${SERVICENAME}_URL environment variable may not work for some users.
Ray
Ray2y ago
I haven't been able to reproduce this issue. Can y'all share a link to your service please?
Want results from more Discord servers?
Add your server