maximum call stack exceeded
Weird bug where whenever I add a
where
eq
clause getting maximum call stack exceeded39 Replies
debugging more right now
angeError: Maximum call stack size exceeded
at <anonymous> (/home/thdxr/dev/projects/goodvisit/saguaro/node_modules/.pnpm/[email protected]_psajsodr3yuurl4pn54idjatoy/node_modules/drizzle-orm/sql/index.js:62:17)
return { sql: chunk.value.join(''), params: [] };
it MySQL?
no postgres
I must be doing something wrong
if you could send example of query to reproduce it
we can check it
Hey, I'm facing a similar issue - any update on this ? Thanks !
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes, I think this is related to having multiple instances of drizzle installed
@thdxr @jeanhdev @michmich this should be resolved by installing
drizzle-orm
to the workspace root using -w
in the meantime, we already have an issue to improve this - https://github.com/drizzle-team/drizzle-orm/issues/283Yes, I fixed it by installing globally on the turborepo w/ the
-w
flag ! @bloberenober helped me 💯Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes, you need to have a single version for all the projects
so you need to remove them anywhere except the root
This problem is still present when I dump the drizzle package to a custom db package and build that.
Then it doesn't make difference if i'm going to install it globally or not.
Are there any plans to fix this issue in the near future:
https://github.com/drizzle-team/drizzle-orm/issues/283
GitHub
Remove
instanceof
checks to allow for multiple drizzle-orm instan...Primary use case is monorepos
It's not a top priority right now, but might be one of the next tasks
so it may be done within a month
I see. Good 2 know. Thank you 🙂
Hi, there's any other workaround? Even without turborepo/monorepo couldn't fix it.
drizzle-orm: > 0.25 gives me this error
drizzle-orm: 0.24 works fine
The stacktrace took me to this file: https://github.com/drizzle-team/drizzle-orm/blob/aadde621556ce61722be2f2b23c8ec66c3408c49/drizzle-orm/src/sql/index.ts#L129
GitHub
drizzle-orm/index.ts at aadde621556ce61722be2f2b23c8ec66c3408c49 · ...
TypeScript ORM for SQL. Contribute to drizzle-team/drizzle-orm development by creating an account on GitHub.
@doiská Could be the same issue. Do you use drizzle directly in your frameworks ?
Yes, but i tried both installing in workspace root and package root, same result. Even moving packages to "single projects"
Weirdly if i use at index with iife, all queries seems to work again
You should avoid to build the package by your own with tsup or tsc
Oh, mb, i was talking about my projects. Im not rebuilding drizzle
I rebuilt without turbo repo/any workspace
Oh i see. I thought cause you mentioned the monorepo. Could you show an example how your structure looks like ?
Do you mean folder structure?
Exactly
If it helps, i can share the repository in private
The server is where drizzle is being used
The build is made using esbuild with context api, some settings are: node16, bundle, alias '@' and loader ts
rn, drizzle is installed as server (package) dependency
Mhm and used nowhere else than inside the server ?
Is the server custom made or built with any framework like nestjs ?
Custom made, right now just using express and some event emitters, no big deal
Theres one more thing, for every endpoint call, i use a setImmediate with promise resolving the response. Just to be similar to the way FiveM works
And no, its not being used anywhere outside server.
I tried removing it, no difference
The only way i made > 0.25 works was inside a iife, idk why
If i use drizzle directly:
It gives me the error, but using an import, it works:
import { getTweets } from "@server/apps/twitter/twitter-tweets.db";
@doiská If you use it directly it get built twice i guess. And thats the same issue then like with monorepos mentioned above. Seems we need to wait for that fix.
im using a normal monorepo without any tools like turborepo.
Basically i have a config folder which has the schema file for drizzle + deps
Then i have 2 apps, each will run on their own docker container, the config folder will be copied to both of the containers.
What would be the workaround here?
The monorepo consists of more apps written in different langauges and i do not want to install npm packages at the root level
Im doing something like this for now which works, but i hope this issue gets a proper solution soon
I think I get it, my problem only happens when I bundle the drizzle-orm using esbuild. If i set it as externals, it works perfectly
My esbuild config
Thanks @Siris @s1njar ^^
those of you with the problem, what version of pnpm do you have?
I have the same issue now with latest version of pnpm without turborepo
I'm also facing this issue,
If you have a monorepo (with or without using turborepo), install
drizzle-orm
(and drizzle-kit
/drizzle-zod
, if you're using them) in the workspace root using -w
@Dan Kochetov mind explaining why it's happening? I am just curious
Because of how monorepo's dependencies work internally, there might be multiple Drizzle instances at runtime, even if it's installed once, which it currently cannot handle properly. It's one of my priorities for this month to fix.
not working with yarn v3 workspaces 🤔
is there any solution?
nvm. I was loading and using a package that creates drizzle instances. When I create instance in server workspace, it works fine.
should work the same
I don't have monorepo but still getting this same error when using where 🤔
Can confirm, shit went south when drizzle was installed in multiple packages in mono.
0.27.0 soon 👀