Pioter
DTDrizzle Team
•Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
If anyone stumbles upon similar problem, the cause turned out to be Next.js cache.
Since Next 14, adding
noStore()
to my server actions involving Drizzle calls to Neon’s Postgres database (as described in the official Next 14 guide here) solved the problem.27 replies
DTDrizzle Team
•Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
I am using Next.js 13 with the app router with the intention of hosting it on Vercel
27 replies
DTDrizzle Team
•Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
Still the same issue, when
neonConfig.fetchConnectionCache
is set to false
. I followed the guide on Drizzle's website, regarding the Neon connection: https://orm.drizzle.team/docs/quick-postgresql/neon27 replies
DTDrizzle Team
•Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
27 replies
DTDrizzle Team
•Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
Absolutely . I tried several times
27 replies
DTDrizzle Team
•Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
27 replies
DTDrizzle Team
•Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
27 replies
DTDrizzle Team
•Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
I removed the prepared statement, which means the function is now defined as follows:
Cleared all the cache, etc. Still the same issue: undefined
27 replies
DTDrizzle Team
•Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
27 replies
DTDrizzle Team
•Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
Ok, I was able to add another branch with a configuration for Next 13, Next-Auth, Drizzle, and MySQL at PlanetScale. All using the exact same logic and nearly identical code. Everything works perfectly fine, which leads me to think there must be something wrong with the way Drizzle and Neon work together in this case.
There are no TypeScript errors, no warnings, no linting errors, everything seems to be fine and yet, I am experiencing unexpected behaviour and I cannot figure out why some functions return undefined. Especially that the exact same functions work fine, when using Drizzle with PlanetScale, instead of Neon.
I am pretty sure I followed the documentation and that I am using correct syntax. Please, have a look at the code - especially the sign up with password part. It starts with the form and its
onSubmit()
function, which relies on the signUpWithPasswordAction()
, which calls getUserByEmailAction()
, which uses a prepared statement defined as follows:
So the getUserByEmailAction()
is defined as:
And this is being used in the signUpWithPasswordAction()
as follows:
For some weird reason, the user is always undefined
, even though I am absolutely certain that at this point the user is already in a database and I can see that user, both in drizzle-kit studio and in the console at neon.tech.
Why is this happening? Why does the exact same flow work perfectly well with Planetscale's MySQL?
The PlanetScale's branch is called next-auth-drizzle-planetscale-mysql
, and the Neon's branch is called next-auth-drizzle-neon-postgres
.
Thanks!27 replies