[SOLVED]NextAuth with drizzle orm error: getUserByAccounT
Answered
Spot-billed Duck posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Spot-billed DuckOP
So this is the error:
https://pastebin.com/wt7dw3ZW
(or [next-auth][error][adapter_error_getUserByAccount]
https://next-auth.js.org/errors#adapter_error_getuserbyaccount relation "account" does not exist {
message: 'relation "account" does not exist',
....}
My schema.ts:
https://pastebin.com/Eu31NGnm
and my nextauth config: https://pastebin.com/AD8E4UEU
https://pastebin.com/wt7dw3ZW
(or [next-auth][error][adapter_error_getUserByAccount]
https://next-auth.js.org/errors#adapter_error_getuserbyaccount relation "account" does not exist {
message: 'relation "account" does not exist',
....}
My schema.ts:
https://pastebin.com/Eu31NGnm
and my nextauth config: https://pastebin.com/AD8E4UEU
17 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Spot-billed DuckOP
posted as txt:
schema as txt:
and nextauth :
related to #JWT_TOKEN_ERROR NextAuth with @Capelin and @Dunker
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Dunker
you are not exporting your accounts, sessions and verificationTokens tables
// schema.ts
-const accounts = pgTable(
+export const accounts = pgTable(
-const sessions = pgTable(
+export const sessions = pgTable(
-const verificationTokens = pgTable(
+export const verificationTokens = pgTable(
remove drizzle folder, and run that package.json commands to generate, push db and run dev server
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Spot-billed DuckOP
okay i'll try it, btw it's a postgre error no ?
and I get this schéma from official doc
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Spot-billed DuckOP
I did it, same error
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Spot-billed DuckOP
I found the error:
With t3 stack, tables are composed like that:
{projetname}_table
With t3 stack, tables are composed like that:
{projetname}_table
but nextauth is searching in 'table'
so myprojet_account != account
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Dunker
so, what you think
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Spot-billed DuckOP
I just removed the prefix, now it works 🙂
Answer
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Dunker
awesome for real
now you can mark this as solved and remove it