having issues with querying db
hi, ive recently migrated from prisma to drizzle but i havne't had any luck with querying the data. ive attached pictures of my drizzle config and where i instantiate and export the db. ive also included a pic of a function where i try to query a user by their username. after line 67, no lines of code are run and nothing is ever returned from the query. please let me know if im doing something wrong, thanks in advance!
7 Replies
Remove resolve dirname or is that updated in the docs?
Im not sure i cant spot where it could error have you made sure the database url is correct?
You havent shared the queries it might probaly be just an error in how its queried
Wait why are you using drizzle with pg and querying data using redis? This has nothing to do with drizzle your error i supose?
If only the drizzle query is not working i suppose it does work but you are using ilike incorrectly
im just copying code from the docs here: https://orm.drizzle.team/learn/migrate/migrate-from-prisma#overview-of-the-migration-process
i tried it without dirname and same issue
Drizzle ORM - Learn
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
yeah its the same database url that i was connecting to prisma with
oh no i just have redis in the function to check if theres any cached data to pull. if no redis data is found itll query the db which is where the function is halting
none of my other queries work either like getting a user by id so i figured it would be a bigger overarching issue with the config, schema, or the way im instantiating db or something like that
Hello, @ethan! Could you please
console.log()
your database url?I think the problem is related to env
, the url might be undefined
or try to add
to your config and db filesoh hey i think i solved the issue... im using supabase and have connection pooling enabled. if you have connection pooling enabled on supabase you have to turn prepare off so something like this will work:
figured id put the solution here in case anyone else was facing this issue 🙂 thanks for the help
Btw, in your first example you was using
node-postgres
and problem could be that you forgot to add this lineohh gotcha my mistake. thanks for catching that