Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
5 replies
George

How to set the generated vercel preview url as the env variable for NEXTAUTH_URL

Hello, so i have succesfully been able to create a github workflow that generated a new postgres db via a neon branch and a vercel preview deployment for every pull request I make and any subsequent commits to that PR.

However I have noticed that NextAuth does not seem to be working because I have to set the NEXTAUTH_URL in my .env as the url of the generated preview deployment. And this url is random everytime it deploys.

Also the I need the preview url to put into my env while building the app, but I can only generate the preview url after building the app.

Has anyone encountered a similar problem, any advice on this would be greatly appreciated, thank you.

I have also attached some images of my workflow, so hopefully that helps.
image.png
image.png
Was this page helpful?