Reaguarding next auth error
Answered
zomb posted this in #help-forum
zombOP
Please can anyone help me in this.. Tried updating the code ample of times but still no improvements... Can anyone try to clone this from code and deploy it and tell the issue I would be glad...
My project code
https://github.com/hemanthhhhhh/food-website
My project code
https://github.com/hemanthhhhhh/food-website
Answered by Ray
move your authConfigs to other file and export it from there instead of exporting it inside
route.js
24 Replies
Ray
move your authConfigs to other file and export it from there instead of exporting it inside
route.js
Answer
zombOP
I have done it too.. See my utils folder.. I have exported it from there and imported inside api/auth/[...nextauth]/route page
Can you please make a pull request or like show me exactly inside my github where to make the necessary changes and what to do.. Have been struggling for 2 days with this error
Ray
still got error?
what is the error now?
Yi Lon Ma
The screeshot is exactly same to what you posted a day earlier, did you actually redeploy?
zombOP
Yea actually the same error is occuring again
No change
Yi Lon Ma
delete the project from vercel and create it again
zombOP
This is the new error now... There is no end to it 💀
Yi Lon Ma
you didn't fix the imports of
authOptions
the errors are clear, fix them
zombOP
I have see
Created a new file, exported authoptions from there and imported in the auth/[... nextauth]/route
Yi Lon Ma
you also need to fix these imports as well
zombOP
Now this 🙂
zombOP
How to fix this any idea?
Yi Lon Ma
https://github.com/vercel/next.js/discussions/33051
literally the first google search result
literally the first google search result
Ray
You are using path alias to import
move
and change
clientPromise
in authConfigmove
utils
folder inside src
and change
import {User} from '../src/models/User'
to import {User} from '@/models/User'
Ray
also, fix the import path in api/auth/[...nextauth]/route after you move
utils
folderzombOP
Thankyou for the help it's solved 🎉🎆