Skip to content

Error while creating new user with prisma adapter #4515

@marsidorowicz

Description

@marsidorowicz

Adapter type

@next-auth/prisma-adapter

Environment

System:
OS: Windows 10 10.0.19044
CPU: (6) x64 Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
Memory: 7.20 GB / 31.92 GB
Binaries:
Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (101.0.1210.32)
Internet Explorer: 11.0.19041.1566
npmPackages:
next: ^11.1.3 => 11.1.3
next-auth: ^4.3.4 => 4.3.4
react: ^17.0.2 => 17.0.2

npmPackages:
@next-auth/prisma-adapter: ^1.0.3 => 1.0.3

Reproduction URL

https://github.com/nextauthjs/next-auth-example

Describe the issue

Seems like one data object in AccountUncheckedCreateInput is missing:
data.created_at

Invalid p.account.create() invocation in

16 },
17 updateUser: ({ id, ...data }) => p.user.update({ where: { id }, data }),
18 deleteUser: (id) => p.user.delete({ where: { id } }),
→ 19 linkAccount: (data) => p.account.create({
data: {
xxx
}
})

Unknown arg created_at in data.created_at for type AccountUncheckedCreateInput. Available args:

type AccountUncheckedCreateInput {
id?: String
userId: String
type: String
provider: String
providerAccountId: String
refresh_token?: String | Null
access_token?: String | Null
expires_at?: Int | Null
token_type?: String | Null
scope?: String | Null
id_token?: String | Null
session_state?: String | Null
}

Error:
Invalid p.account.create() invocation in

16 },
17 updateUser: ({ id, ...data }) => p.user.update({ where: { id }, data }),
18 deleteUser: (id) => p.user.delete({ where: { id } }),
→ 19 linkAccount: (data) => p.account.create({
data: {
provider: 'coinbase',
type: 'oauth',

   }
 })

Unknown arg created_at in data.created_at for type AccountUncheckedCreateInput. Available args:

type AccountUncheckedCreateInput {
id?: String
userId: String
type: String
provider: String
providerAccountId: String
refresh_token?: String | Null
access_token?: String | Null
expires_at?: Int | Null
token_type?: String | Null
scope?: String | Null
id_token?: String | Null
session_state?: String | Null
}

name: 'LinkAccountError',
code: undefined
}

How to reproduce

add coinbase provider with credentials
login using coinbase
use database prisma adapter

Expected behavior

adapter should add Account along with User

Metadata

Metadata

Assignees

No one assigned

    Labels

    adaptersChanges related to the core code concerning database adaptersprisma@auth/prisma-adaptertriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions