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