You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, it does so every time, even when NEXTAUTH_URL is already explicitly initialized as a regular environment variable.
This behavior is misleading. Someone who sets NEXTAUTH_URL and doesn't know about NextAuth.js support has no reason to think NEXTAUTH_URL will be changed. It also blocks people who need to set NEXTAUTH_URL to a particular value (more about this below).
Log this particular behavior so people who know about NextAuth.js support are not surprised.
As an aside, why would you want to explicitly set NEXTAUTH_URL? For example in case of multi-domains support. This can be achieved with multiple domains and a middleware. You can find an advanced example of this in the Vercel Platform Starter Kit. A classic setting would be for the app to serve both example.com (+ www.example.com) and app.example.com. As the subdomain suggests, NEXTAUTH_URL will be set to https://app.example.com. Currently, the plugin just doesn't allow it.
Steps to reproduce
I don't think this issue needs any guidance in this respect. The behavior is straightforward and fits in 5 lines of code.
I am building using file-based configuration (netlify.toml)
What OS are you using?
No response
Your netlify.toml file
`netlify.toml`
# Paste content of your `netlify.toml` file here
Your public/_redirects file
`_redirects`
# Paste content of your `_redirects` file here
Your next.config.js file
`next.config.js`
# Paste content of your `next.config.js` file here. Check there is no private info in there.
Builds logs (or link to your logs)
Build logs
# Paste logs here
Function logs
Function logs
# Paste logs here
.next JSON files
generated .next JSON files
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.
The text was updated successfully, but these errors were encountered:
@ericapisani I was wondering if .env files could be taken into account for this as well? I was still experiencing this bug until I found out from the pull request comments that next.config.js was the right place for setting the user-defined NEXTAUTH_URL. In my case, I write the values to .env file dynamically in the Netlify build step.
Summary
Because the plugin supports NextAuth.js, it sets
NEXTAUTH_URL
automatically at deploy.However, it does so every time, even when
NEXTAUTH_URL
is already explicitly initialized as a regular environment variable.This behavior is misleading. Someone who sets
NEXTAUTH_URL
and doesn't know about NextAuth.js support has no reason to thinkNEXTAUTH_URL
will be changed. It also blocks people who need to setNEXTAUTH_URL
to a particular value (more about this below).Suggested change:
NEXTAUTH_URL
, do nothing when it is already defined.As an aside, why would you want to explicitly set
NEXTAUTH_URL
? For example in case of multi-domains support. This can be achieved with multiple domains and a middleware. You can find an advanced example of this in the Vercel Platform Starter Kit. A classic setting would be for the app to serve both example.com (+ www.example.com) and app.example.com. As the subdomain suggests,NEXTAUTH_URL
will be set to https://app.example.com. Currently, the plugin just doesn't allow it.Steps to reproduce
I don't think this issue needs any guidance in this respect. The behavior is straightforward and fits in 5 lines of code.
A link to a reproduction repository
No response
Plugin version
@netlify/[email protected] from Netlify app
More information about your build
netlify.toml
)What OS are you using?
No response
Your netlify.toml file
`netlify.toml`
# Paste content of your `netlify.toml` file here
Your public/_redirects file
`_redirects`
# Paste content of your `_redirects` file here
Your
next.config.js
file`next.config.js`
# Paste content of your `next.config.js` file here. Check there is no private info in there.
Builds logs (or link to your logs)
Build logs
Function logs
Function logs
.next JSON files
generated .next JSON files
The text was updated successfully, but these errors were encountered: