Open FroeMic opened 1 month ago
I've temporarily resolved by using the previous patch "@auth/drizzle-adapter": "1.4.1"
The hard part was to figure out how to ask about this issue in google. here a more detailed error description.
I had a similar issue, migrated back to 1.4.1. It went away when I upgraded drizzle-orm to version 0.33.0.
It also seems like the authenticators table doesn't include the PgUuid type for user id when it's a uuid, so an incompatibility there as well
Adapter type
@auth/drizzle-adapter
Environment
Reproduction URL
https://github.com/FroeMic/t3-auth-test
Describe the issue
After running
npm create t3-app@latest
the NextAuth DrizzleAdapter throws a Typescript error in/src/server/auth.ts
(see reproduction example.It seems that the schemas generated by drizzle are not compatible with the ones the adapter expects. Some properties expected by the column type of the adapter are not provided by the schemas generated by drizzle.
Using the first example from the PostgreSQL schema.ts example from https://authjs.dev/getting-started/adapters/drizzle#schemas:
Schema
Typescript Error (formatted)
What does that mean? The
DefaultPostgresColumn
type definition in adapter-drizzle/src/lib/pg.ts expects for each column values (isAutoincrement
,isPrimaryKey
,hasRuntimeDefault
,generated
), that the schema generated bypgTable
doesn't have.How to reproduce
You should be able to reproduce the error by running
npm create t3-app@latest
with the above mentioned options and then opening/src/server/auth.ts
and/src/server/db/schema.ts
Expected behavior
The Table / Column Definitions generated by Drizzle are compatible with the Adapter.