Error message in vanilla /app directory & drizzle project
I wanted to try out the new /app router setup using drizzle, but when selecting these options I got this error:
Type 'import("/home/peter/workspace/t3/drizzle-approuter2/node_modules/@auth/core/adapters").Adapter' is not assignable to type 'import("/home/peter/workspace/t3/drizzle-approuter2/node_modules/next-auth/adapters").Adapter'.
Types of property 'createUser' are incompatible.
Type '((user: AdapterUser) => Awaitable<AdapterUser>) | undefined' is not assignable to type '((user: Omit<AdapterUser, "id">) => Awaitable<AdapterUser>) | undefined'.
Type '(user: AdapterUser) => Awaitable<AdapterUser>' is not assignable to type '(user: Omit<AdapterUser, "id">) => Awaitable<AdapterUser>'.
Types of parameters 'user' and 'user' are incompatible.
Property 'id' is missing in type 'Omit<AdapterUser, "id">' but required in type 'AdapterUser'.ts(2322)
Has anyone else seen something similar? I haven't used Drizzle before, so my apologies for this very nooby question.
4 Replies
This is my package.json:
{
"name": "drizzle-approuter2",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "next build",
"db:push": "dotenv drizzle-kit push:mysql",
"db:studio": "dotenv drizzle-kit studio",
"dev": "next dev",
"lint": "next lint",
"start": "next start"
},
"dependencies": {
"@auth/drizzle-adapter": "^0.3.6",
"@planetscale/database": "^1.11.0",
"@t3-oss/env-nextjs": "^0.7.1",
"@tanstack/react-query": "^4.36.1",
"@trpc/client": "^10.43.6",
"@trpc/next": "^10.43.6",
"@trpc/react-query": "^10.43.6",
"@trpc/server": "^10.43.6",
"drizzle-orm": "^0.28.5",
"next": "^14.0.3",
"next-auth": "^4.24.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"server-only": "^0.0.1",
"superjson": "^2.2.1",
"zod": "^3.22.4"
},
"devDependencies": {
"@next/eslint-plugin-next": "^14.0.3",
"@types/eslint": "^8.44.7",
"@types/node": "^18.17.0",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"autoprefixer": "^10.4.14",
"dotenv-cli": "^7.3.0",
"drizzle-kit": "^0.20.7",
"eslint": "^8.54.0",
"mysql2": "^3.6.1",
"postcss": "^8.4.31",
"prettier": "^3.1.0",
"prettier-plugin-tailwindcss": "^0.5.7",
"tailwindcss": "^3.3.5",
"typescript": "^5.1.6"
},
"ct3aMetadata": {
"initVersion": "7.25.0"
},
"packageManager": "[email protected]"
}
I encountered the same issue, and found this bug report:
https://github.com/nextauthjs/next-auth/issues/9493
I remediated it with the following changes to
src/server/auth.ts
:
GitHub
Types of property 'createUser' are incompatible · Issue #9493 · nex...
Environment System: OS: Windows 11 10.0.22000 CPU: (32) x64 AMD Ryzen 9 3950X 16-Core Processor Memory: 88.88 GB / 127.94 GB Binaries: Node: 20.6.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 ...
Thanks a lot @Reineblut , I completely missed that bug report while looking for the answer. 🙏
All good my friend. Happy new year!