milk enjoyer
milk enjoyer10mo ago

Got "Maximum call stack size exceeded" when checking validity of types when using zid

Hi, I recently came across this error, and after narrowing down which parts it was from, one instance was when I imported and used zid from within my nextjs project. But I am not exactly sure why this happens in this project as I managed to import zid without any issue in other nextjs projects. I am still debugging it and I am sure there is something else which is the issue but just wondering if you guys have seen anything similar and can give some clues.
18 Replies
erquhart
erquhart10mo ago
Do you mean zod? I haven’t had any issues like this with it so far. Happy to look at offending code if you can share any.
milk enjoyer
milk enjoyerOP10mo ago
zid from convex-helpers
erquhart
erquhart10mo ago
Ah, gotcha - so if you import without using or referencing, that’s enough to trigger the error?
milk enjoyer
milk enjoyerOP10mo ago
Import + use it in nextjs app. This usually works (did this before in other projects) but it doesnt for this particular project.
erquhart
erquhart10mo ago
Just trying to understand the repro case - importing alone doesn’t do it, but usage does. Is it specific usage? If you use it once in a simplistic way, does it throw? Trying to narrow down potential cause, since it’s not happening elsewhere
milk enjoyer
milk enjoyerOP10mo ago
it only fails in one particular repo of mine it is a bit hard to explain, i can add you to the repo if you want to take a look\
erquhart
erquhart10mo ago
I’m up for that - I’m mobile right now but can take a look in the am
milk enjoyer
milk enjoyerOP10mo ago
sure, whats your github username?
erquhart
erquhart10mo ago
Same as here, erquhart
milk enjoyer
milk enjoyerOP10mo ago
I managed to create a drastically simpler repro: just run tsc --noEmit and you will see the error. Remove the zid import and you will be able to tsc with no error.
milk enjoyer
milk enjoyerOP10mo ago
the error shows up as long as you import anything at all from convex-helpers
erquhart
erquhart10mo ago
Yeah importing anything from convex helpers blows the stack, and the errors aren't even consistent. Same result using either bun or npm. Strict mode isn't causing it Question: why no tsconfig in your convex directory?
jamwt
jamwt10mo ago
@ian maybe take a look at this repro ^ since it's convex-helpers related
erquhart
erquhart10mo ago
I'm not sure I'd expect this to work with no convex specific tsconfig, it's all going off of the root config. It looks like most properties are included there, but the other settings could be causing issues. _generated should be excluded and isn't, but addressing that didn't fix the issue.
ian
ian10mo ago
Try installing typescript@5.3 The newest version of typescript seems to be failing- I just noticed it yesterday and haven’t root caused it
erquhart
erquhart10mo ago
Yep, that seems to fix it
ian
ian10mo ago
convex-helpers version 0.1.26 works with typescript@5.4 now @milk enjoyer 🎉
milk enjoyer
milk enjoyerOP10mo ago
Awesome thanks!

Did you find this page helpful?