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
13 Replies
Project ID:
3a7cb6bb-8dc2-4a24-9308-522c7ed2812c
3a7cb6bb-8dc2-4a24-9308-522c7ed2812c
can you show the value of the variable in railways ui that shows up empty on vercel?
oops totally forgot to add that
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
it seems like variables arent being rendered before being sent to vercel, everything you are doing looks good to me
Thread has been flagged to Railway team by @Brody.
gotcha, appreciate the 2nd set of eyes! i'll see if i can setup a webhook to make this work
to confirm your hypothesis -
NIXPACKS_PYTHON_VERSION
is empty on Vercel, but should be pulling from a shared variable on Railway that is not emptyany reason why you have a shared variable when theres only one service lol?
there used to be 2 services in there haha
fair enough