New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Edge Function deployments #21394
Comments
Is there any rough timeline on when this will be able for preview / released? I need a temporary fix for an issue I'm having which this would make obsolete and it would be great to have this context. Can't wait to see this, thanks! |
No timeline for preview or release, but we expect to send out first invites to early access to survey participants in days or weeks, not months. |
Any updates to a more GA or widespread release? |
We are working towards a public preview release of this soon. |
Hi @janpio, many thanks to you and the team for rolling out support for this issue. That being said, I saw on another thread that MongoDB is not supported yet with this rollout. Is this on your roadmap/is there a timeline for this? |
@gramliu Unfortunately, we are not aware of any way to talk to MongoDB databases from edge function environments, there are edge compatible no drivers for MongoDB. We need a driver that uses a HTTP or Websocket API (like the Neon and PlanetScale serverless drivers), as that is the preferred communication method for edge function deployments, or a database driver that is supported on one of those platforms like (Besides: Prisma Accelerate is built partially to avoid cold start issues with your database connection, so I suggest you get in contact with our Platform support team to figure out what is going on there.) |
Sorry Prisma. I can't wait and move to Kysely. |
Is there any update on when this will be ready? I have a product I'm ready to deploy and I'd prefer to use Cloudflare Workers instead of Vercel but would have to rewrite a lot of code to remove Prisma and use something else. I also generally prefer Prisma as a product in general as well as the people who work on it. Thanks. |
@coratype I don't know your use case but i would recommend using Prisma Accelerate as a workaround until this is ready. I am currently doing that for my MVP. For this small thing, the free "Starter" plan is sufficient for now. |
It's a social media application so requests will be high, I'd have to consider the costs first but I'll look into it |
Yes, this is currently in Early Access and we expect to open it up for Preview publicly soon. Not that of course we do not know what our users - like you - will then actually find for us to fix, so it is super hard to say when this Preview will really be ready for production use. Generally using databases from edge functions environments is a pretty new thing, compared to the old school Node or Serverless environments. |
I'm not running a production app but building one without any deadline (personal project) By using cloudflare deployment and maintenance is REALLY cheaper compared to vercel, sst or any other provider due to bandwidth in cf is almost free. P.S.: I was digging into the D1 code since it's available under lastest release of prisma, and so far it's working good. My 2c I'll share when gets preview stage:
|
Thanks for working on it, in that case I'll hold off on launch, albeit I did apply for the preview |
Hey everyone! We just released Prisma ORM version 5.11.0 which includes a preview feature for Edge Functions support via Cloudflare Workers and Pages and Vercel Edge Functions and Middleware in Prisma ORM 🥳
Please give it a try, and let us know how it goes! If you encounter any problems, please create a new bug report issue, or if the problem is driver adapter specific, use the feedback discussions for PS: We are also working on support for Cloudflare D1, and expect to share news in this feature request issue soon. (Early Access for that is already in progress) |
Is there a plan to roll out support for Supabase on the edge? |
@brunocascio Could you open an issue? About your problem with the D1 adapter:
I could not reproduce this, but I'm very curious to reproduce this and would need your help for this. About Migrations, we definitely want to have a better experience there, so stay tuned 📻 |
Sure! -> #23479 |
@janpio Are you going to support supabase ? If yes, when ? |
@johannbuscail @atanaskanchev Not yet, but that is definitely an option we can look into. Go and leave a 👍 reaction on this new issue I created to track the demand for these platforms: #23512 Thanks! |
@janpio Any plan on supporting MongoDB ? Thanks ! |
There is unfortunately no database driver for MongoDB available that works on edge function deployments. As soon as that changes we can consider adding support for it as well - but this is unfortunately out of our control. |
Hey @janpio. I'm wondering if I've misunderstood the recent feature previews. Initially, I used the Postgres adapter in my Next.js middleware. I understand why that didn't work now, because it's trying to run in an edge runtime. Total misstep on my part. However, I'm now using the Neon adapter which in theory supports edge runtimes (right?). But I'm getting all sorts of errors, which I'm happy to list out. I just wanted to get a sense check that it's even possible to use this in Next.js? I'm only working locally right now, so my thinking is isolated to Next.js and not Vercel hosting. Here's how I've got my client configured: import { Pool } from '@neondatabase/serverless'
import { PrismaNeon } from '@prisma/adapter-neon'
import { PrismaClient } from '@prisma/client'
export const db = new PrismaClient({
adapter: new PrismaNeon(
new Pool({ connectionString: process.env.DATABASE_URL })
)
}) Am I going in the right direction? Or is this a non-starter right now? |
That should indeed work. Please open a new bug issue with more information so we can debug this. Thanks. |
@janpio Good to know! Another detail is I'm using a local Postgres database and not Vercel Postgres. That should also still work, yes? |
Probably not, as Vercel Postgres and Neon Postgres have a proxy in front of their database that allows the serverless driver to talk to it via Websockets instead of TCP (which is the default communication method with databases, but not supported in edge function environments or Next.js middleware). You can see here how we run that proxy ourselves locally so the driver adapter can work with a local PostgreSQL database: prisma/docker/docker-compose.yml Lines 223 to 239 in 4954f35
See here for someone else sharing how they got that to work: #21310 (comment) |
See #21394 (comment) for links 🔒 |
Currently Prisma can only be used in Edge Function deployments when you use Prisma Accelerate and
@prisma/client/edge
. Although we like our own product very much, that should not be a requirement to use Prisma in any environment you want to develop and deploy your app.We want to support deploying apps using Prisma Client to any Edge Function environment.
Please help us by filling this short survey: https://pris.ly/survey/edge-functions If you leave your email address, you can also be considered for early access for testing and evaluating this. Thanks.
The text was updated successfully, but these errors were encountered: