R
Railway12mo 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
Percy12mo ago
Project ID: 3a7cb6bb-8dc2-4a24-9308-522c7ed2812c
jasonaa
jasonaa12mo ago
3a7cb6bb-8dc2-4a24-9308-522c7ed2812c
Brody
Brody12mo ago
can you show the value of the variable in railways ui that shows up empty on vercel?
jasonaa
jasonaa12mo ago
oops totally forgot to add that
No description
jasonaa
jasonaa12mo ago
No description
jasonaa
jasonaa12mo 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
Brody12mo ago
it seems like variables arent being rendered before being sent to vercel, everything you are doing looks good to me
Duchess
Duchess12mo ago
Thread has been flagged to Railway team by @Brody.
jasonaa
jasonaa12mo ago
gotcha, appreciate the 2nd set of eyes! i'll see if i can setup a webhook to make this work
jasonaa
jasonaa12mo 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
Brody12mo ago
any reason why you have a shared variable when theres only one service lol?
jasonaa
jasonaa12mo ago
there used to be 2 services in there haha
Brody
Brody12mo ago
fair enough