T3 stack issues with auth
Getting the following error. I can't find any resources online for it
17 Replies
Hey! It'll be easier to help if you provide more context. I'm not sure if anyone will be able to help you with just the stack trace
Try posting some code and context of what you are trying to achieve!
That's the base create-t3-app template using discord auth
plugged in proper secret and id stuff in env
with generated secret
switched to mongo with prisma
did db pull or whatever the command was
and now auth doesn't work
/src/pages/api/auth/[...nextauth].ts
/prisma/schema.prisma
^Great! I hope someone can help you now, I'm at the airport so I'm not able to look at investigate this rn
It's definitely something with your db though
So make sure that part is setup correctly
You need to npx prisma db push
The schema
And make sure you are connected to the DB locally
Your database URL should be a localhost and port
Instantly suspecting mongodb as the problem
It's not MongoDB, it's the user Setup.
@Hycord can you provide an example public repository and let us fork it to test?
(I've got mine spun up and working absolutely fine using discord auth)
as you're able to see on https://mongodb-t3.vercel.app/
Create T3 App
Generated by create-t3-app
cheers
I've noticed also one ID field being incorrect
id String @id @map("_id")
needs to be mapped to something
@db.ObjectID
If you look up the prsima integration doc on nextauth you fill find what is most likely the culprit
I don't see the user table for instance
And based on how that error reads it's likely that's the case
Perhaps the session table too I'm not sure
my schema pretty much looks like this, added an example table as well
And it works fine
Op's schema is kinda weird
Yea it's just missing everything from the t3 setup
Not 100% sure since I'm new with auth as to what's required, but I'm pretty sure I got it running within 20 mins or so. It's straightforward honestly.
Guessing OP is hosting an app that has access to banning people from the App/Discord and would like to go that route
Not 100% sure
You're missing the core requirements to use NextAuth
Afterwards run
add these to your schema and run the commands, discord auth will work.
Also, removing a model in your schema results to an actual table being removed in the DB.
Auth requires Session User and Account, the rest of the tables can be configured by you.
I've managed to reproduce the error by foolishly deleting [User, Account, Session] > which is commented out as "// Necessary for Next auth"
Running npx prisma db push and npx prisma generate
causing me to fail on dev
return these, and you'll be fine.
If you have any other questions, open another question topic, cheers! ^^
I've left access to the public repo, however I've removed the mongodb integration from deployment
https://github.com/Ambushfall/mongodb-t3
GitHub
GitHub - Ambushfall/mongodb-t3
Contribute to Ambushfall/mongodb-t3 development by creating an account on GitHub.
This does work, thankyou
Quite welcome