-
Notifications
You must be signed in to change notification settings - Fork 86
[Bug]: NextAuth basic middleware causes 500 internal error on all page .json file requests #1679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @Joroze , Thanks for submitting an issue. Unfortunately I haven't been able to replicate the behaviour that you've mentioned (all of my tests thus far have shown the Could you potentially provide us with a minimal reproduction? |
@ericapisani Try loading the /admin page in the new deploy preview. |
@ericapisani The easiest way to replicate is by using my provided middleware example from their official documentation for protecting all routes (which I need in my use case) |
@ericapisani I replicated a more simple demo of the issue occurring here: https://github.com/Joroze/next-netlify-starter-nextauth/pull/1 |
@Joroze Amazing, thank you! And good call out on the I'll move this into my team's backlog so someone can start taking a look at this when they're available. |
Thanks @ericapisani . I believe the /me page wouldn't work either. Any page that the Auth middleware is covering basically. |
I wanted to add that in addition to the issues already reported, the middleware I'm following examples taken from this topic for having the NextAuth middleware skip my custom Typography public assets: vercel/next.js#36308 (comment) |
Internal: Ticket ID: |
Hi @Joroze , Thanks for your patience. I've taken a look at this today, and just to rule this out as a possible source of your 500 errors - have you set the The reason I'm asking is because not setting it results in a |
Hi @ericapisani I'm left confused because this release (#1309) mentions NextAuth support out of the box with only having to set the Auth Secret env var (which I did) Here are the logs of the deploy preview build (this PR: https://github.com/Joroze/next-netlify-starter-nextauth/pull/1)
|
Hi @Joroze, I'm so sorry, I wrote Thanks for confirming that you set the secret though, I'll take a look at the deploy preview logs for the site that your provided to see what I can find |
@Joroze I've merged a fix which should address your issue as part of version
to confirm? I tested it with the sample project that you had provided but just want to double check before considering this fully resolved. |
@ericapisani confirmed and works now. Thanks! |
Summary
I'm deploying a basic NextJS project using NextAuth basic middleware as documented here: https://next-auth.js.org/configuration/nextjs#basic-usage
When loading any page route, I get the page's .json internal server errors as a response multiple times.
Steps to reproduce
https://next-auth.js.org/configuration/nextjs#basic-usage
middleware.tsx
Relevant dependency versions:
A link to a reproduction repository
No response
Next Runtime version
4.25.0
More information about your build
netlify.toml
)What OS are you using?
Mac OS
Your netlify.toml file
`netlify.toml`
Your public/_redirects file
`_redirects`
# Paste content of your `_redirects` file here
Your
next.config.js
file`next.config.js`
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: