DT
Drizzle Teamthdxr
maximum call stack exceeded
Weird bug where whenever I add a
where
eq
clause getting maximum call stack exceededT
thdxr•406d ago
debugging more right now
angeError: Maximum call stack size exceeded
at <anonymous> (/home/thdxr/dev/projects/goodvisit/saguaro/node_modules/.pnpm/drizzle-orm@0.23.5_psajsodr3yuurl4pn54idjatoy/node_modules/drizzle-orm/sql/index.js:62:17)
return { sql: chunk.value.join(''), params: [] };
AS
Andrii Sherman•406d ago
it MySQL?
T
thdxr•406d ago
no postgres
I must be doing something wrong
AS
Andrii Sherman•406d ago
if you could send example of query to reproduce it
we can check it
S
sevenwestonroads•389d ago
Hey, I'm facing a similar issue - any update on this ? Thanks !
UU
Unknown User•388d ago
B
bloberenober•388d ago
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/283S
sevenwestonroads•388d ago
Yes, I fixed it by installing globally on the turborepo w/ the
-w
flag ! @bloberenober helped me 💯UU
Unknown User•387d ago
B
bloberenober•387d ago
yes, you need to have a single version for all the projects
so you need to remove them anywhere except the root
S
s1njar•382d ago
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
B
bloberenober•382d ago
It's not a top priority right now, but might be one of the next tasks
so it may be done within a month
S
s1njar•382d ago
I see. Good 2 know. Thank you 🙂
D
doiská•381d ago
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.
S
s1njar•381d ago
@doiská Could be the same issue. Do you use drizzle directly in your frameworks ?
D
doiská•381d ago
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
S
s1njar•381d ago
You should avoid to build the package by your own with tsup or tsc
D
doiská•381d ago
Oh, mb, i was talking about my projects. Im not rebuilding drizzle
I rebuilt without turbo repo/any workspace
S
s1njar•381d ago
Oh i see. I thought cause you mentioned the monorepo. Could you show an example how your structure looks like ?
D
doiská•381d ago
Do you mean folder structure?
S
s1njar•381d ago
Exactly
D
doiská•381d ago
If it helps, i can share the repository in private
D
doiská•381d ago
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
S
s1njar•381d ago
Mhm and used nowhere else than inside the server ?
Is the server custom made or built with any framework like nestjs ?
D
doiská•381d ago
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";
S
s1njar•381d ago
@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.
S
Siris•381d ago
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
D
doiská•380d ago
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 ^^
T
thdxr•363d ago
those of you with the problem, what version of pnpm do you have?
H
hachoter•351d ago
I have the same issue now with latest version of pnpm without turborepo
T
TSilver•351d ago
I'm also facing this issue,
B
bloberenober•350d ago
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
H
hachoter•349d ago
@Dan Kochetov mind explaining why it's happening? I am just curious
B
bloberenober•349d ago
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.
M
Mini•346d ago
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.
B
bloberenober•346d ago
should work the same
W
walt_terry•335d ago
I don't have monorepo but still getting this same error when using where 🤔
P
polkovnik•334d ago
Can confirm, shit went south when drizzle was installed in multiple packages in mono.
AS
Andrii Sherman•334d ago
0.27.0 soon 👀
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
7.3KMembers
View on DiscordWant results from more Discord servers?
More PostsDrizzle recommended way to migrate resetApologies if this is a stupid question, I just recently migrated out of prisma and into drizzle. Onecompound uniqueIndexIn Prisma, I have in my schema definition the following declaration that requires userId and timestaplanetscale: how to index col using drizzle?Hi, seems most of the samples are pg. I'm using planetscale, and no having any luck figuring out how[Bug?] Drizzle generates a broken query when passing an explicit value for a column as `undefined`I've translated most of my logic from Prisma usage -> Drizzle. Noticed an issue where when explicitlHelp improving my queryIf feel like this is far from how what it actually should look like in drizzle could I get some poinLeft join with JSONI'm using PlanetScale (MySQL) and have 2 tables: orders and products.
Every order contains basic infDrizzle-kit throws module not found error for internal files imported through absolute pathI've attached the error log and how the error was fixed.drizzle bug won't let me update mysql tablewrote a bug ticket on github describing the bug but just wanted to post here as well for visibility
Generated Collate valueNot sure if this is relevant but I'm translating a Prisma schema into drizzle. Every Prisma table haCan I know when I can use Mysql proxy driver?Hi, I’m Daun and I’m a huge fan of drizzle. i’m really grateful that drizzle is open source and haveMocking databaseI want to mock the PostgreSQL database and access it with Drizzle ORM. I tried to write a TypeScriptWhat does MySQL bigint config mode do?In a mysql schema, when creating a bigint, it wants a config object with a `mode` key where mode couMySQL unique constraintIn the drizzle schema, is there a way to label a column with unique constraint in mysql? I'm only seError querying planetscale dbTrying to get setup with drizzle and running into this error. There's not much info here so I'm not db push connection errorgetting the following error on my first db push attempt
```
Ignoring invalid configuration option paSelect existsHi there,
I was wondering if there is currently a good way of performing a ‘select exists’, to checCustom SQL function (json_agg & json_build_object)Hello there.
I'm new to Drizzle and I love it 😍.
I have successfully made a `jsonAgg` helper.
`Error migrating after updating to orm 0.23.3After updating to the package released an hour ago, I am getting an error on migrating:
error - Ranworkflow best practices with planetscaleSo I’m building a small test app (drizzle looked amazing and will definitely want it in my main app Invalid default value for timestampHi, I have recently started learning SQL and I've run into this problem with Drizzle Kit. I have thi