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

DrizzleAdapter Type error #12211

Open
IzaanAnwar opened this issue Nov 10, 2024 · 0 comments
Open

DrizzleAdapter Type error #12211

IzaanAnwar opened this issue Nov 10, 2024 · 0 comments
Labels
adapters Changes related to the core code concerning database adapters bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@IzaanAnwar
Copy link

Adapter type

@auth/drizzle-adapter

Environment


  System:
    OS: Linux 6.10 Manjaro Linux
    CPU: (4) x64 11th Gen Intel(R) Core(TM) i3-1115G4 @ 3.00GHz
    Memory: 1.70 GB / 7.47 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 22.2.0 - ~/.nvm/versions/node/v22.2.0/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v22.2.0/bin/npm
    pnpm: 9.8.0 - ~/.local/share/pnpm/pnpm
    bun: 1.1.17 - ~/.bun/bin/bun
  npmPackages:
    @auth/drizzle-adapter: ^1.7.3 => 1.7.3 
    next: 14.2.5 => 14.2.5 
    next-auth: 5.0.0-beta.25 => 5.0.0-beta.25 
    react: ^18.3.1 => 18.3.1 

Reproduction URL

https://github.com/IzaanAnwar/auth-ex/

Describe the issue

I have been getting this type error for so long and I have no clue how to fix it:

const authConfig = { adapter: DrizzleAdapter(db), session: { strategy: "jwt", }, // ........ more config }

And this line adapter: DrizzleAdapter(db), results in the following error:
Type 'AdapterUser' is not assignable to type 'Awaitable<AdapterUser>'. Type 'AdapterUser' is missing the following properties from type 'AdapterUser': role, accessToken, isSubActive, channelId, refreshToken

How to reproduce

"@auth/drizzle-adapter": "^1.7.3", and "drizzle-orm": "^0.36.1",

declare module "next-auth" {
interface Session {
user: {
id: UserId;
role: UserRole;
accessToken: string | null;
isSubActive: boolean | null;
channelId: string | null;
refreshToken: string | null;
} & DefaultSession["user"];
}
interface User {
id: UserId;
role: UserRole;
accessToken: string | null;
isSubActive: boolean | null;
channelId: string | null;
refreshToken: string | null;
}
}

Expected behavior

Should not get any type erros.

@IzaanAnwar IzaanAnwar added adapters Changes related to the core code concerning database adapters bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

1 participant