Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Types of property 'createUser' are incompatible. (node_modules/@auth/core and node_modules/next-auth) #1716

Closed
novelnet opened this issue Jan 3, 2024 · 2 comments

Comments

@novelnet
Copy link

novelnet commented Jan 3, 2024

Provide environment information

System:
OS: macOS 14.2.1
CPU: (10) arm64 Apple M1 Pro
Memory: 1.24 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.19.0 - /opt/homebrew/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 10.2.3 - /opt/homebrew/bin/npm

Describe the bug

Getting following error in building:

./src/server/auth.ts:49:5
Type error: Type 'import("/Users/x/Code/lead-generator/node_modules/@auth/core/adapters").Adapter' is not assignable to type 'import("/Users/x/Code/lead-generator/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'.

  47 |         })
  48 |     },
> 49 |     adapter: DrizzleAdapter(db, mysqlTable),
     |     ^
  50 |     providers: [
  51 |         GoogleProvider({
  52 |             clientId: env.GOOGLE_CLIENT_ID,
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproduction repo

https://github.com/t3-oss/create-t3-app

To reproduce

Creating a plain standard t3 app with drizzle ORM:

 npm create t3-app@latest

◇  What will your project be called?
│  dbtest
│
◇  Will you be using TypeScript or JavaScript?
│  TypeScript
│
◇  Will you be using Tailwind CSS for styling?
│  Yes
│
◇  Would you like to use tRPC?
│  Yes
│
◇  What authentication provider would you like to use?
│  NextAuth.js
│
◇  What database ORM would you like to use?
│  Drizzle
│
◇   EXPERIMENTAL  Would you like to use Next.js App Router?
│  Yes
│
◇  Should we initialize a Git repository and stage the changes?
│  Yes
│
◇  Should we run 'npm install' for you?
│  Yes
│
◇  What import alias would you like to use?~/

Using: npm

✔ dbtest scaffolded successfully!

Additional information

No response

@novelnet
Copy link
Author

novelnet commented Jan 3, 2024

Fix (same with DrizzleAdapter):

import type { Adapter } from 'next-auth/adapters';

[...]
adapter: PrismaAdapter(prisma) as Adapter

Originally posted by @bayasdev in nextauthjs/next-auth#9493 (comment)

@juliusmarminge
Copy link
Member

cc @balazsorban44 did versions fall out of sync again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants