subRows.map is not a function
I am getting a subRows.map is not a function error when adding the "with" parameter to my relational queries.
here is my schema;
23 Replies
cc @Dan Kochetov
errors with subRows.map is not a function
returns the party object with autor: null
I use AWS Data API RDS running a postgresql11.13 engine
will check
any luck eith this
cannot use relations bc of the error
not yet, but will look into it shortly
@Dan Kochetov i think i found the problem
AWS-Data-api returns everything in objects such as { stringValue: "[]" }, and that is why subRows.map is not a function bc subRows is still a object
doesn't drizzle handle objects returned by aws? bc now aws is only returning objects and it also makes it impossible for relations i imagine
so strange thing, drizzle does handle this with old syntax like db.select().from(users), but doesnt whit relational queries
Thanks for the investigation! I'll check it.
{"data1":[{"id":{"longValue":34},"name":{"stringValue":"poyraz"}}],"data2":[{"id":34,"name":"poyraz"}]}
data1 is db.query.users.findMany(), data2 is db.select().from(users)
new error: Relation author not found
still the same data is being returned
it is not getting parsed
checking further
the actual issue was I didn't extract the field values from the Data API format for relational queries. Had to spin up an instance to test properly AWS won again
Should be now fixed (for real) in
[email protected]
@poyrazError: Cannot find module 'drizzle-orm/version'
Require stack:
- /Users/poyrazbirbil/Desktop/poyrazProjects/fiesta/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
new error cannot find drizzle-orm/version
i am using sst btw
i also cannot query any data from sst as it says package not found drizzle-orm
maybe i did smth wrong
will check it out later
did you start seeing these errors after one of the recent updates, or are you setting up a new project?
started seeing them after updating to af636c3
going back to latest drizzle version fixes the error
0.26.3 isnt throwing any erros
did you install drizzle-orm and drizzle-kit in the monorepo root?
sst uses a monorepo setup
so currently you need to install drizzle in the root using
-w
i initiate the db through the core package
do i still need to install drizzle and drizzle kit in root of monorepo
downloading in root doesnt change much
still same error
and i dont think you need to install drizzle in root bc it was working just fine when i only had it installed in packages/core
it might've happened because you installed another Drizzle version
try removing all node_modules from the monorepo, removing drizzle-orm and drizzle-kit from package dependencies and adding them as monorepo root dependencies
quick question
does my drizzle.config.ts have to be in the root folder aswell
no, but it'll be easier if it is, because drizzle-kit will detect it automatically
so removed drizzle-kit and drizzle-orm from packages/core
removed node modules
installed using -w
still same error throwing
full error
the command i am trying to run is pnpm drizzle-kit generate:pq
Any updates on this? Pretty frustrating as i cannot use relations with aws-data-api 😦
Not a lot of ideas at the moment honestly, @Andrew Sherman might take a look, since it might be kit-related
thats a bummer, @Andrew Sherman any idea what could be causing this issue?
I guess the best way to help me is if you can create a new GH repo with minimal reproducible example
no need for code or anything, just as simplier as possible where this issue will appear
then I can just clone it and try it myself
👋 i've got an example where this pops up, but with bun and sqlite - https://github.com/sammccord/drizzle-relations-repro
not sure if this is the best place to bring it up, or if it's an issue with bun and I should go there
GitHub
GitHub - sammccord/drizzle-relations-repro
Contribute to sammccord/drizzle-relations-repro development by creating an account on GitHub.