NEXTAUTH_URL for PR builds

I’m wondering if anybody has a great solution for setting the NEXTAUTH_URL env var dynamically for PR builds. Right now we’re going in and manually copying and pasting the PR URL in as the NEXTAUTH_URL env for the PR env. Is there a way to use RENDER_EXTERNAL_HOSTNAME automatically so we don’t have to do that?


you can achieve this via your start command, NEXTAUTH_URL=$RENDER_EXTERNAL_HOSTNAME yarn start. I actually added this approach to our docs for React but the same applies for Next - see this at

I hope that helps,

John B

Oh sweet! Thanks for pointing that out. I’m gonna try it now

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.