How do I use Prisma w/ Cloudflare Hyperdrive + MySQL using Cloudflare Workers
Hi
I wanted to use Prisma with Cloudflare Hyperdrive + MySQL on Cloudflare Workers.
I searched online and found that someone is using postgres adapter for postgres database. But I can't find the same one for MySQL(like adapter-mysql or something).
I also found https://github.com/sidorares/node-mysql2/pull/2289 mentioned on https://www.prisma.io/docs/orm/prisma-client/deployment/edge/deploy-to-cloudflare . however, this doesn't support Prisma afaik.
Is there any mysql driver I can use?
GitHub
feat: support Cloudflare Workers by Mini256 · Pull Request #2289 ...
try to close #2179
Summary
To fix the error window is not found, replace node Timers with web timers
To fix the error Code generation from strings disallowed for this context, using the static par...
Deploy to Cloudflare Workers & Pages | Prisma Documentation
Learn the things you need to know in order to deploy an app that uses Prisma Client for talking to a database to a Cloudflare Worker or to Cloudflare Pages.
3 Replies
You chose to compile with the bot. One moment while I piece together your answer…
Based on the knowledge sources provided, there isn't specific information about using Prisma with Cloudflare Hyperdrive + MySQL on Cloudflare Workers.
Currently, Prisma supports Cloudflare Workers through driver adapters, which are in Preview. The documentation mentions support for:
1. Cloudflare D1 (SQLite-based) using the
@prisma/adapter-d1
package Build Applications at the Edge with Prisma ORM & Cloudflare D1
2. PostgreSQL on Cloudflare Workers using @prisma/pg-worker
, which is "an optimized and lightweight version of pg
that is designed to be used in a Worker" Github Issue #23744
However, there is no specific mention of a MySQL adapter for Cloudflare Workers in the provided knowledge sources. The documentation does indicate that Prisma is working on expanding edge function support, but as of the information available, there's no explicit MySQL adapter for Cloudflare Workers.
If you're looking to use MySQL with Prisma in Cloudflare Workers, you might want to:
1. Check the latest Prisma documentation for any updates on MySQL support in edge environments
2. Consider using D1 (Cloudflare's native serverless database) which is supported by Prisma
3. Look into the PlanetScale serverless driver, which was mentioned in the knowledge sources as a potential future integration, though it's not currently supported Github Issue #15265
For the most up-to-date information, I'd recommend checking Prisma's official documentation or reaching out to their support channels.
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.Hi
I can trust what AI is saying. but the Github Issue #15265 that AI just provided is resolved over 2 1.5 years ago.
I thought AI's knowledge is very outdated. so is there any Github Issue/Docs I can follow?
I just found that MySQL support for Hyperdrive is released 16 hours ago.
I was able to add MySQL connection to Hyperdrive few days ago so I thought this was supported for long time 😅
anyway, my question still remains because I want to know as soon as Prisma support this.
Thanks for letting me know that MySQL support for Hyperdrive was released. I haven't tried it it but will try soon 🙂