-
Notifications
You must be signed in to change notification settings - Fork 2.1k
strictUndefinedChecks does not work with query extensions #25845
Copy link
Copy link
Closed
Labels
bug/2-confirmedBug has been reproduced and confirmed.Bug has been reproduced and confirmed.kind/bugA reported bug.A reported bug.topic: `query` Client Extensiontopic: clientExtensionstopic: strictUndefinedChecks
Description
Bug description
When using the $allModels.$allOperations query extension, any usages of Prisma.skip cause an error to be thrown.
How to reproduce
- Set
Prisma.skipin a create query for a prisma client with query extensions - Running the file will trigger an error like this:
PrismaClientValidationError:
Invalid `prisma.employee.create()` invocation in
/tmp/tmp.MOsQACwvAB/2024-12-12T233959/index.js:20:17
17 }
18 }
19 });
→ 20 prisma.employee.create({
data: {
email: "0.19827359060498662@example.com",
name: {}
~~
}
})
Argument `name`: Invalid value provided. Expected String or Null, provided Object.
at En (/tmp/tmp.MOsQACwvAB/2024-12-12T233959/node_modules/@prisma/client/runtime/library.js:29:1363)
at Mn.handleRequestError (/tmp/tmp.MOsQACwvAB/2024-12-12T233959/node_modules/@prisma/client/runtime/library.js:121:6981)
at Mn.handleAndLogRequestError (/tmp/tmp.MOsQACwvAB/2024-12-12T233959/node_modules/@prisma/client/runtime/library.js:121:6663)
at Mn.request (/tmp/tmp.MOsQACwvAB/2024-12-12T233959/node_modules/@prisma/client/runtime/library.js:121:6370)
at async l (/tmp/tmp.MOsQACwvAB/2024-12-12T233959/node_modules/@prisma/client/runtime/library.js:130:9633) {
clientVersion: '6.0.1'
}
Expected behavior
An error is not thrown
Prisma information
generator client {
provider = "prisma-client-js"
previewFeatures = ["strictUndefinedChecks"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Employee {
id String @id @default(cuid())
name String?
email String @unique
}const prisma = new PrismaClient().$extends({
query: {
$allModels: {
// Example query extension that does nothing
$allOperations: async (params) => params.query(params.args),
}
}
});
prisma.employee.create({ data: { email: `${Math.random()}@example.com`, name: Prisma.skip } }).then((result) => {
console.log(result)
}).catch((error) => {
console.error(error)
})Environment & setup
- OS: Debian
- Database: PostgreSQL
- Node.js version: v20.18.0
Prisma Version
Environment variables loaded from .env
prisma : 6.0.1
@prisma/client : 6.0.1
Computed binaryTarget : debian-openssl-1.1.x
Operating System : linux
Architecture : x64
Node.js : v20.18.0
Query Engine (Node-API) : libquery-engine 5dbef10bdbfb579e07d35cc85fb1518d357cb99e (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Schema Engine : schema-engine-cli 5dbef10bdbfb579e07d35cc85fb1518d357cb99e (at node_modules/@prisma/engines/schema-engine-debian-openssl-1.1.x)
Schema Wasm : @prisma/prisma-schema-wasm 5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e
Default Engines Hash : 5dbef10bdbfb579e07d35cc85fb1518d357cb99e
Studio : 0.503.0
Preview Features : strictUndefinedChecks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug/2-confirmedBug has been reproduced and confirmed.Bug has been reproduced and confirmed.kind/bugA reported bug.A reported bug.topic: `query` Client Extensiontopic: clientExtensionstopic: strictUndefinedChecks