[GH-ISSUE #873] Prisma strictUndefinedChecks #8476

Closed
opened 2026-04-13 03:33:22 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @bmichotte on GitHub (Dec 13, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/873

Describe the bug
Prisma 5.20.0 introduced a new (preview) feature which is strictUndefinedChecks which allows you to disallow undefined values, you have to set the value to Prisma.skip instead

If we have this selected and for example want to create a user with

    const response = await auth.api.signUpEmail({
        body: {
            name,
            email,
            password,
        },
    })

it produces an Error

          data: {
            id: "IrBhtCpliP7FiC-iik9Hw",
            name: "Some name",
            email: "some@email.com",
            emailVerified: false,
            image: undefined,
                   ~~~~~~~~~
            createdAt: new Date("2024-12-13T10:29:44.031Z"),
            updatedAt: new Date("2024-12-13T10:29:44.031Z"),
          },
          select: undefined
        })

    Invalid value for argument `data`: explicitly `undefined` values are not allowed.

To Reproduce
Steps to reproduce the behavior:

  1. Create a project with Prisma 5.20.0+
  2. Configure prisma with
generator client {
    provider        = "prisma-client-js"
    previewFeatures = ["strictUndefinedChecks"]
}
  1. create a user

Expected behavior
The correct change should be

image: someImage ?? Prisma.skip,
Originally created by @bmichotte on GitHub (Dec 13, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/873 **Describe the bug** [Prisma 5.20.0](https://github.com/prisma/prisma/releases/tag/5.20.0) introduced a new (preview) feature which is `strictUndefinedChecks` which allows you to disallow `undefined` values, you have to set the value to `Prisma.skip` instead If we have this selected and for example want to create a user with ```ts const response = await auth.api.signUpEmail({ body: { name, email, password, }, }) ``` it produces an Error ``` data: { id: "IrBhtCpliP7FiC-iik9Hw", name: "Some name", email: "some@email.com", emailVerified: false, image: undefined, ~~~~~~~~~ createdAt: new Date("2024-12-13T10:29:44.031Z"), updatedAt: new Date("2024-12-13T10:29:44.031Z"), }, select: undefined }) Invalid value for argument `data`: explicitly `undefined` values are not allowed. ``` **To Reproduce** Steps to reproduce the behavior: 1. Create a project with Prisma 5.20.0+ 2. Configure prisma with ```ts generator client { provider = "prisma-client-js" previewFeatures = ["strictUndefinedChecks"] } ``` 3. create a user **Expected behavior** The correct change should be ```ts image: someImage ?? Prisma.skip, ```
GiteaMirror added the locked label 2026-04-13 03:33:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8476