Cole
Cole•4d ago

Really appreciate the help, trying to

Really appreciate the help, trying to come up with a solution so that I can leverage Convex for its realtime capabilities and use Postgres for the relational side of things
27 Replies
Sara
Sara•4d ago
The error indicates that the Prisma Client was generated for a different runtime environment than the one required during deployment. Specifically, the client was generated for "debian-openssl-1.1.x" but the deployment environment requires "debian-openssl-3.0.x". To resolve this, update the binaryTargets in the schema.prisma file to include "debian-openssl-3.0.x" and regenerate the Prisma Client by running prisma generate. This ensures the correct query engine is available at runtime. Additionally, verify that the Prisma Client is being generated in the expected output path and that no bundler or deployment configuration (such as optimizePackageImports in Next.js) is interfering with the inclusion of the query engine file ^ that's an AI generated result from google
Cole
ColeOP•4d ago
Hmm, curious Let's give it a shot Same result unfortunately
Sara
Sara•4d ago
I'm thinking that it might be the convex environment
Cole
ColeOP•4d ago
Yeah me too
Sara
Sara•4d ago
That's making it behave wierd
Cole
ColeOP•4d ago
Ensure that you ran prisma generate and that "libquery_engine-debian-openssl-3.0.x.so.node" has been copied to "data/tmp/.tmphP04YY/source/841c2d5a-2c11-4a5a-bfd9-2a2621f8d6c3/modules/_deps/node". This is a bit of a clue
Sara
Sara•4d ago
😅
Cole
ColeOP•4d ago
There's prisma accelerate but isn't that another cost?
Sara
Sara•4d ago
Don't know much about that, sorry!
Cole
ColeOP•4d ago
* IMPORTANT: Prisma in Convex Serverless Environment
* ------------------------------------------------------
* Convex's serverless runtime has limitations with native Node.js binaries (.so.node files).
*
* RECOMMENDED SOLUTION: Use Prisma Accelerate
* - Prisma Accelerate is a connection pooler that works without native binaries
* - Set up at: https://www.prisma.io/data-platform/accelerate
* - Use DATABASE_URL from Accelerate (starts with prisma://)
*
* ALTERNATIVE: Call Next.js API Routes
* - Keep Prisma in Next.js API routes
* - Call those routes from Convex actions using fetch()
* - See convex/vulnerabilities/processing_new.ts for examples
* IMPORTANT: Prisma in Convex Serverless Environment
* ------------------------------------------------------
* Convex's serverless runtime has limitations with native Node.js binaries (.so.node files).
*
* RECOMMENDED SOLUTION: Use Prisma Accelerate
* - Prisma Accelerate is a connection pooler that works without native binaries
* - Set up at: https://www.prisma.io/data-platform/accelerate
* - Use DATABASE_URL from Accelerate (starts with prisma://)
*
* ALTERNATIVE: Call Next.js API Routes
* - Keep Prisma in Next.js API routes
* - Call those routes from Convex actions using fetch()
* - See convex/vulnerabilities/processing_new.ts for examples
Maybe just leave it in next api route then?
Sara
Sara•4d ago
The only solution i can think of is to create a separate environment for it, and access it with Http I've got one sentence: wtf I'm wondering if something like airbyte would help, or to break out of prisma and sql and move all to convex depending on how large your project is
Cole
ColeOP•4d ago
I started off with using only Convex But things quickly slowed down as I tried to import 12,000+ rows of data and perform JOIN queries And then there's the damn "too many bytes read in a single function" warning Which is inherently due to the fact that convex is again not optimized for OLAP
Sara
Sara•4d ago
I see i see Are you using a monorepo?
Cole
ColeOP•4d ago
Yeah
Cole
ColeOP•4d ago
No description
Cole
ColeOP•4d ago
Nice and organized
Sara
Sara•4d ago
If you've got an api folder in your app use that to access the HTTP requests, if not, create a separate api package with prisma and hono, and create your requests there, and place the hono api url to the .site of convex, if that didn't work, use it under your localhost:3001/api or something like that Hono is very small and fast enough to not cost you delays
Cole
ColeOP•4d ago
The current approach right now is Next API routes that are able to work with Prisma properly
Sara
Sara•4d ago
That's the only thing i can think of, or airbyte Nice! Great to hear
Cole
ColeOP•4d ago
I think ultimately you're right though that API calls will be the "escape hatch" for convex in this edge case Normally that's actions in "use node" But even that can't handle whatever it is that prisma is doing to generate their client
Sara
Sara•4d ago
ClickHouse
Real-Time Data Analytics Platform | ClickHouse
Get real-time insights with ClickHouse, the high-performance data analytics platform. Reap the benefits of streamlined data analysis and try for free today.
Sara
Sara•4d ago
Tbf prisma is scuffed
Cole
ColeOP•4d ago
Yeah that's why I was so thrilled about convex
Sara
Sara•4d ago
I haven't worked with it for 2 years 😂 i always go with drizzle if i had to
Cole
ColeOP•4d ago
I never got the chance to dive into drizzle Ideally I don't want to have to bother with any of that
Sara
Sara•4d ago
That's also a good point
Cole
ColeOP•4d ago
Convex Ents might be another approach, but it's not officially backed by convex so there are some concerns with stability and continued support

Did you find this page helpful?