Skip to content

Commit 9866f71

Browse files
fix(adapters): handle P2025 errors without importing Prisma namespace (#13061)
Co-authored-by: Thang Vu <[email protected]>
1 parent 29de85b commit 9866f71

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/adapter-prisma/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @module @auth/prisma-adapter
1717
*/
18-
import { Prisma, type PrismaClient } from "@prisma/client"
18+
import type { PrismaClient } from "@prisma/client"
1919
import type {
2020
Adapter,
2121
AdapterAccount,
@@ -89,7 +89,9 @@ export function PrismaAdapter(
8989
// If token already used/deleted, just return null
9090
// https://www.prisma.io/docs/reference/api-reference/error-reference#p2025
9191
if (
92-
error instanceof Prisma.PrismaClientKnownRequestError &&
92+
error &&
93+
typeof error === "object" &&
94+
"code" in error &&
9395
error.code === "P2025"
9496
)
9597
return null

0 commit comments

Comments
 (0)