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
BTW: Both next.js and fastify are working just fine, the problem is with the way next-auth proceeds with the POST callback request.
How to reproduce
Use next.js with external server,
Set up next-auth,
Try to log in,
Submit the form,
Callback won't work.
Expected behavior
It should proceed with the callback.
The text was updated successfully, but these errors were encountered:
breftejk
added
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Jul 15, 2024
I solved this by moving the Next request handler into onRequest (before Fastify parses the body):
fastify.all('*',{// nextjs does its own POST body parsing, must run before fastifyonRequest: async(req,res,next)=>{res.hijack()try{awaitpreparedPconstparsedUrl=URL.parse(req.url,true)awaithandleNextRequest(req.raw,res.raw,parsedUrl)}catch(err){console.error('Error in',req.url,err)res.statusCode=500res.raw.end('Internal server error')}next()},handler: ()=>{},})
This can probably cleaned up further, but it works.
Environment
Reproduction URL
https://github.com/Discord-Dashboard/Base-Theme
Describe the issue
Running next on external server, you cannot use next-auth. It will work, but the callback causes it to... break.
Error:
BTW: Both next.js and fastify are working just fine, the problem is with the way next-auth proceeds with the POST callback request.
How to reproduce
Expected behavior
It should proceed with the callback.
The text was updated successfully, but these errors were encountered: