Next-runtime plugin is using localhost as NEXTAUTH_URL

I deployed a nextjs site, and specified the next-auth URL in the UI environment variable, however inspecting the functions I noticed this

https://drive.google.com/file/d/1gFtrX65mSuO3JjsKNkBK8uJyHFIzb-D7/view?usp=drivesdk

I’ve tried to redeploy several times changing the URL in the UI. Unfortunately I couldn’t figure it out.
I deployed directly from a Linked GitHub repo which has a .env.example file, where I set next-auth URL to localhost, I doubt netlify would use that.

I’ve made a previous deployment from the CLI, (manual deploy) It didn’t give me any issue. But I don’t want to manually deploy this because of CI.

Any solution for this?

Chances are that file is overriding the ones in the UI? Though, if you could share the site name or deploy ID, we could investigate further.

I also tried redeploying (with clear cache) after deleting the .env.example from the repo it still sets next-auth URL to localhost:3000
Site name: thirdbook

It’s happening because of:

Because of this:

the URL in your config is given preference.

2 Likes

Thanks a bunch. The issue is resolved.

1 Like