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
Project ID:
f568f607-e4d1-4517-ba1a-537dc9a8be86
f568f607-e4d1-4517-ba1a-537dc9a8be86
can you send a browser screenshot of your project
what kind of screenshot?
railway project?
bruh
full screenshot of your browser window with the railway project in question open
and what service is trying to access RAILWAY_SERVICE_MPC_API_URL
docs mention the static url env vars to be
RAILWAY_{serviceName}_STATIC_URL
while the env variable is actually RAILWAY_SERVICE_{serviceName}_URL
i know, i dont understand that either
RAILWAY_SERVICE_MPC_API_URL
would be correctthe
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 stringokay now what exactly is the mpc service?
mpc service is a web client service (nextjs app)
can you show me how you are accessing the variable in code
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
variable exists...
is that an .env file?
that's from the app
it's a dump of the env vars
while running on railway?
the project doesn't have .env vars in the git repo
while running on railway?yes
ssr next app?
yea
next13
dont variables have to be prefixed with something?
like
NEXT_
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 serverim sorry i cant reproduce this
https://utilities.up.railway.app/env-vars
you must be overriding them or something
Overriding them? nope...
they're just empty string vars
i think it's a bud on railway's side...
im sorry i cant reproduce thisYes, because it should work - but since yesterday it just doesn't bud=bug 😄
deploy an absolute bare minimun nodejs service, no framework, nothing, just index.js and package.json and inside that index.js file simply put
how do I see the console log after deploying?
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
now with domains set, RAILWAY env vars are still empty:
remind me, is this the first time you mentioned this being a pr environment?
it happens on non-pr envs
now after rebuilding with domains set the vars aren't empty
show me the code behind these printouts please?
index.js:
scripts.start/build are both set to
node index.js
can you share the repo for that?
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?
id like to see the exact code that made this output
this helps? xD
the vars arent empty?
after rebuilding - no, aren't empty
filled correctly
but on production env's they are empty
despite having domains set
okay will flag team
🙏
thank you!
sorry it took so long to get to this point, i just had to be sure it was on railway's end
all good! looking forward for their reply
Flagging this thread. A team member will be with you shortly.
👋
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Hey! Sorry for the delay here. Can you try re-deploying the env-vars test service? I wanna see what happens under the hood
redeploying now
deployment id: a7a2cd62-8cbe-4707-a5a9-acda79551715
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
e.g. remove the service and add it from scratch?
yep
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 isthen what isn't being populated
all the other services
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...
I can confirm. Going to raise this up, thanks!
Thanks!
I am having this problem too
it will be looked into
https://discord.com/channels/713503345364697088/1114802678015479868/1114802678015479868
RAILWAY_SERVICE_${SERVICENAME}_URL
environment variable may not work for some users.
I am encountering the same issue here, please help to fix this.
it will be looked into
https://discord.com/channels/713503345364697088/1114802678015479868/1114802678015479868
RAILWAY_SERVICE_${SERVICENAME}_URL
environment variable may not work for some users.
I haven't been able to reproduce this issue. Can y'all share a link to your service please?