zod-prisma-types
zod-prisma-types copied to clipboard
Is the requirement to use Zod 3.21.1 or below gone?
I saw the issue in the documentation here has been closed and merged with zod =< 3.23.0
Has this been confirmed as a fix for the issue?
I have tested locally and everything seems to be working fine including generation and usage but I don't know what it could have broken so would be great to know.
If it indeed fixes the issue, only a documentation update is required.
After a bit of testing, it looks like it works initially but at build time it looks like it creates a memory leak.
I get back this error:
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----
1: 00007FF73B5EDA2B node::SetCppgcReference+15611
2: 00007FF73B55AFE4 DSA_meth_get_flags+86548
3: 00007FF73C1BE351 v8::Isolate::ReportExternalAllocationLimitReached+65
4: 00007FF73C1AAF76 v8::Function::Experimental_IsNopFunction+2918
5: 00007FF73BFF4DA0 v8::internal::StrongRootAllocatorBase::StrongRootAllocatorBase+31760
8: 00007FF73B88568D BIO_ssl_shutdown+189
9: 7FF8000000000000
Testing versions with memory leak: "zod": "^3.23.8", "zod-prisma-types": "^3.1.6"
Versions that complete build as before.
"zod": "^3.21.1",
"zod-prisma-types": "^3.1.6"
Is this an issue with zod-prisma-types or zod itself? I couldn't find any open issues on zod relating to this.
@willscottrod didyou figure out what the problem was? I never encountered this issue in my projects. 🤔
@chrishoermann sorry for the delay in getting back to you. Turns out it was just an internal error with my packages being too big haha. After cleaning up my packages and some tech debt, it built perfectly with ^3.23.8 but haven't tested runtime yet.
I'm still using the zod ^3.21.1 for now just to be safe but will move versions up soon and run some thorough tests and let you know if I find any issues with it.
@chrishoermann I want to bring up that I'm also running into this heap memory issue whenever using any of the generated schemas. Same exact error. Currently running "zod-prisma-types": "^3.1.8".
Attempted to use downgraded Zod
to version ^3.21.1
but with no success.
For context I have over 75 models in my schema, most of them don't need a zod schema generated for them though. But the way the builds fail, almost make it seem like a cyclic dependency issue since the build stalls and then fails 30 seconds later.
@Ciccio99 what you're describing is likely unrelated if your zodiac version has no impact on your issues. Your TS server is running out of memory. Some of many things you can try: increasing allocated memory, reducing use of particularly complex TS types, ensuring the generated zod files are gitignored and not being tracked in your tsconfig
@drakedeatonuk This heap error only occurs when importing/using generated schemas from zod-prisma-types
. It builds and deploys fine otherwise when not using it.
Is there another way to force zod-prisma-types
to use the correct version of zod
? I specifically had ^3.21.1
installed and then created the export of it so that the generator would use it
generator zod {
provider = "zod-prisma-types"
output = "./generated/zod"
imports = "./zod-utils#z"
}
Also added to ensure that any dependencies were using the correct version
"resolutions": {
"zod": "3.21.1"
}
I've also attempted increasing the allocated memory the the max possible when building and this issue still occurs. Again, it seems like an odd circular dependency issue or recursive issue since it stalls out and then crashed with a Heap memory error (But that can definitely be a red herring).
Same problem. Can You detail how to fix it? Where to put resolutions?
Same problem. Can You detail how to fix it? Where to put resolutions?
I didn't find a specific solution after various rabbit hole investigations. Ended up removing the library and just making my schemas/types as needed w/ base zod.