Synced PR Envs w/Vercel
ekohilas
PROOP

a month ago

How do I sync Railway's PR preview environments with Vercel's PR preview environments?

Our Vercel config has an env var to point to the URL of the backend, and Railway has a variable that specifies the public URL, but it's unclear how to make Vercel point to the preview PR env of railway

Solved

34 Replies

You can set up CICD pipelines to update Vercel environment variables (via Vercel API) when a PR is created.


ekohilas
PROOP

a month ago

Doesn’t railway sync env vars with vercel?


I don't think there's native sync...? Nevermind 💀

This exists:

-# Thanks medim


ekohilas
PROOP

a month ago

Thanks I've already connected this 😊


ekohilas
PROOP

a month ago

The problem seems to be that the railway integration doesn't sync preview env vars to be branch specific.


ekohilas
PROOP

a month ago

Is there an example of this? I can't get seem to get mine working


Not sure. Sorry.


ekohilas
PROOP

a month ago

No worries I appreciate it!

What's the best way to get support from the team?


Here...

Is it Railway's API you're having trouble with?


ekohilas
PROOP

a month ago

I am now yes


ekohilas
PROOP

a month ago

to retrieve an env var for a preview environment via the api, I need a token.

but the tokens are per environment, so this wouldn't work because I'd need to generate them on demand


ekohilas
PROOP

a month ago

I may have found it under another page


ekohilas
PROOP

a month ago

nope that token doesn't work


Project tokens should use RAILWAY_TOKEN. Account/workspace tokens should use RAILWAY_API_TOKEN.


Tokens are not per-environment.


They are either account based or project based.


ekohilas
PROOP

a month ago

where do you find this?


Oh thats interesting tokens are now locked to environments…


Try using an account scoped token.

Go to account settings > tokens to create one.


(This is for CLI btw.)


ekohilas
PROOP

a month ago

does an account scoped token need to use RAILWAY_API_TOKEN?


Yes.


ekohilas
PROOP

a month ago

Where are the docs that say RAILWAY_API_TOKEN should be used?


Are you using the public API or the CLI?


ekohilas
PROOP

a month ago

the CLI


ekohilas
PROOP

a month ago

I found where it's documented


ekohilas
PROOP

a month ago

it's just not documented from where you create the account token

The docs point to this but say nothing about needing to use RAILWAY_API_TOKEN


ekohilas
PROOP

a month ago

Thanks for the help @pepper!

Honestly this whole process has been one of the most frustrating I've ever had with a vendor.



All good now? Going to mark this thread as solved if it is.


ekohilas
PROOP

a month ago

Let me provide the answer first for anyone else who bumps into this



Thanks!


Closing this note then.


Status changed to Solved 0x5b62656e5d about 1 month ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...