R
Railway10mo ago
jasonaa

Sync service hostname to environment variable with Vercel

Is it possible to take the hostname of a given service and push it into an environment variable on a Vercel project? I see that environment variables sync from Railway to a linked Vercel project if you enable Railway's Vercel integration, so I tried to create an environment variable with as in the screenshot, but this didn't work as I expected (an env var was made on Vercel but it was empty). The goal is to access an API service deployed in a PR environment on Railway, from the frontend preview deployment on Vercel, so the frontend uses the PR's instance of the API instead of using our prod/staging instance. Would appreciate any pointers on how to achieve this
No description
13 Replies
Percy
Percy10mo ago
Project ID: 3a7cb6bb-8dc2-4a24-9308-522c7ed2812c
jasonaa
jasonaa10mo ago
3a7cb6bb-8dc2-4a24-9308-522c7ed2812c
Brody
Brody10mo ago
can you show the value of the variable in railways ui that shows up empty on vercel?
jasonaa
jasonaa10mo ago
oops totally forgot to add that
No description
jasonaa
jasonaa10mo ago
No description
jasonaa
jasonaa10mo ago
https://docs.railway.app/develop/variables#railway-provided-variables is what I got the railway vars from, although i may be misunderstanding how this is supposed to work
Railway Docs
Variables | Railway Docs
Documentation for Railway
Brody
Brody10mo ago
it seems like variables arent being rendered before being sent to vercel, everything you are doing looks good to me
Duchess
Duchess10mo ago
Thread has been flagged to Railway team by @Brody.
jasonaa
jasonaa10mo ago
gotcha, appreciate the 2nd set of eyes! i'll see if i can setup a webhook to make this work
jasonaa
jasonaa10mo ago
to confirm your hypothesis - NIXPACKS_PYTHON_VERSION is empty on Vercel, but should be pulling from a shared variable on Railway that is not empty
No description
No description
No description
Brody
Brody10mo ago
any reason why you have a shared variable when theres only one service lol?
jasonaa
jasonaa10mo ago
there used to be 2 services in there haha
Brody
Brody10mo ago
fair enough