'zod-prisma keeps getting stuck at the generation step
I just installed zod-prisma
to try it out, but so far nothing is working.
I attempted to run it on two separate projects, one has a small prisma and the other has a relatively large one.
Both didn't work, and remained stuck.
I can't share the schemas unfortunately. So, any ideas what could the problem be?
I also enabled strict in tsconfig, still the same.
prisma : 3.6.0
@prisma/client : 3.6.0
Current platform : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine : migration-engine-cli dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash : dc520b92b1ebb2d28dc3161f9f82e875bd35d727
Studio : 0.440.0
typescript": "^4.5.2"
"zod-prisma": "^0.5.4"
{
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"lib": ["es2018", "esnext.asynciterable"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": true,
"removeComments": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"sourceMap": false,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,
"strict": true
}
}
I also cloned the example in the repo, but it had no zod-prisma configured at all. So, I added this from README:
generator zod {
provider = "zod-prisma"
output = "./zod"
relationModel = true
// relationModel = "default" // Do not export model without relations.
// relationModel = false // Do not generate related model
modelCase = "PascalCase"
// modelCase = "camelCase" // Output models using camel case (ex. userModel, postModel)
modelSuffix = "Model"
// useDecimalJs = false // (default) represent the prisma Decimal type using as a JS number
useDecimalJs = true
imports = null
// https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-by-null-values
prismaJsonNullability = true
// prismaJsonNullability = false // allows null assignment to optional JSON fields
}
but it also got stuck when I ran npx prisma generate
I use node v14.19.1
I upgraded to latest prisma version:
prisma : 3.13.0
@prisma/client : 3.13.0
Current platform : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine : migration-engine-cli efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash : efdf9b1183dddfd4258cd181a72125755215ab7b
Studio : 0.459.0
Still same issue!
On a side note, I would appreciate it if someone with a rep of 1500 or higher could add the zod-prisma
tag.
Solution 1:[1]
There was a missing dependency, simply install zod.
Though, the generator should have displayed a warning.
I also submitted a PR to fix this issue for good!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |