Next.js Discord

Discord Forum

Reaguarding next auth error

Answered
zomb posted this in #help-forum
Open in Discord
Avatar
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
Image
Answered by Ray
move your authConfigs to other file and export it from there instead of exporting it inside route.js
View full answer

24 Replies

Avatar
Ray
move your authConfigs to other file and export it from there instead of exporting it inside route.js
Answer
Avatar
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
Avatar
Ray
still got error?
what is the error now?
Avatar
Yi Lon Ma
The screeshot is exactly same to what you posted a day earlier, did you actually redeploy?
Avatar
zombOP
Yea actually the same error is occuring again
No change
Avatar
Yi Lon Ma
delete the project from vercel and create it again
Avatar
zombOP
Image
Image
This is the new error now... There is no end to it 💀
Avatar
Yi Lon Ma
you didn't fix the imports of authOptions
the errors are clear, fix them
Avatar
zombOP
Image
Image
Image
I have see
Created a new file, exported authoptions from there and imported in the auth/[... nextauth]/route
Avatar
Yi Lon Ma
you also need to fix these imports as well
Image
Avatar
zombOP
Image
Now this 🙂
Avatar
zombOP
How to fix this any idea?
Avatar
Yi Lon Ma
https://github.com/vercel/next.js/discussions/33051
literally the first google search result
Avatar
Ray
You are using path alias to import clientPromise in authConfig
move utils folder inside src
and change import {User} from '../src/models/User' to import {User} from '@/models/User'
Avatar
Ray
also, fix the import path in api/auth/[...nextauth]/route after you move utils folder
Avatar
zombOP
Thankyou for the help it's solved 🎉🎆