require() of ES Module not supported
This isn't too related to drizzle-ORM, but I figured I'd ask it here:
I'm trying to connect drizzle to my PlanetScale database like so:
and it's giving me the following error when I run
npm run dev
I've tried several solutions that people have suggested online, including adding "type": "module"
to my package.json file. Anyone have any ideas as to what's going wrong? I'll send any files if needed.16 Replies
Here's my
package.json
file:
Yeah, I have the same problem now
Any luck?
i got it to work by copying someone from the internet's tsconfig file:
i also added
"type": "module"
to my package.json
file. i'm honestly not too sure what in the file did the trick, but i was so fed up with that bug that i just moved on 😂yeah adding type module screws up the ts
Are you using planetscale?
yup
Did you have an issue with the connection driver?
i believe for my project it was necessary, but you have to change a couple of your configs
not that i remember
Have you tried Prisma with planetscale?
Is it really as bad as YouTube makes it out to be?
tbh the only thing you would need to use prisma is set the relation mode to prisma and make your own indexes on relationships
it’s a bit more work but i think it’s worth it if you’re going to use prisma
Have you seen good experiences with Prisma and PlanetScale?
The company I'm building this for gets 7k visitor/week.
codedamn
YouTube
We need to talk about Prisma
We migrated to SQL a month back and our biggest learning was to never use Prisma. Watch the full video to know what happened and how we found a solution.
Read the full blog here: https://codedamn.com/news/product/dont-use-prisma
Are you confused where to start coding/what to learn/what roadmap to take? Take this free 2 minute quiz: https://c...
This guy terrified the owners regarding the cost.
But no one has actually talked to someone about their experience.
I setup Prisma to implement the indices according to this guy
I personally have never used prisma on a large scale since i’m still a university student, but i can’t imagine it being really fast since it has a huge rust binary and will be bogged down a lot due to traffic
Prisma
YouTube
Prisma & PlanetScale Best Practices
In this video, you will learn about everything you need to know when using Prisma with PlanetScale.
We'll dive into:
- Referential integrity and operating without foreign key constraints
- Migration workflows with Prisma and PlanetScale using the
prisma db push
command
- Defining indices on relation scalars (the foreign key fields).
Update ...Yeah, on my local machine I'm getting 3000ms for a simple login query!
If express validator hits it due to a typo BEFORE the query, it's only 5ms
hmmm interesting
when i’ve used prisma/planet scale my queries have never hit anything over 1000ms rarely