Loading project previews was opening too many database connections, so I set up Prisma Accelerate because it is the recommended connection pooling option by prisma.
This is working for now, and is a good solution at least temporarily, but I don't love it. Mainly for cost & vendor lock-in reasons, but also because it complicates our setup and adds an extra point of failure.
Other possibilities include:
Find an alternative connection pooling option. AWS provides their own, which might pair well with our Amazon RDS database, except it doesn't work with Prisma "due to the way RDS Proxy pins connections" (source). Maybe there are more good options out there, but it feels like we're still going to be locked into an additional piece of infrastructure that we have to pay for.
Move away from Prisma. Something like RDS Proxy might work if we weren't using Prisma. (I haven't done the research to know for sure.) Drizzle ORM is currently in vogue, but I haven't used it personally. I'd rather not make the switch if we don't have to... it feels like a bunch of rewrite work for little benefit, since Prisma has been good enough so far.
Move to a "serverless" Postgresql host like Neon which allows millions of simultaneous connections to a Postges database. The downside here is that BXCoding is providing us with free AWS credits for the year because they had access to extra. It would be a shame to move away from AWS for database hosting.
Move away from serverless. (This would prevent the constant closing and re-opening of database connections.) Instead of hosting on Vercel, we could get a $5/month DigitalOcean droplet or something. (BX Coding is providing us with free AWS credits for this year so there's probably a droplet equivalent available from Amazon. I'd have to look.) Migrating shouldn't be too hard since Next.js can just run as a regular Node app.
Host the project previews separately from the website & editor. The preview just needs to hit the database to match each path to a file and then serve that file. Maybe there's some alternative way of serving the preview separate from our Next.js project that would allow us to keep everything else the same.
Loading project previews was opening too many database connections, so I set up Prisma Accelerate because it is the recommended connection pooling option by prisma.
This is working for now, and is a good solution at least temporarily, but I don't love it. Mainly for cost & vendor lock-in reasons, but also because it complicates our setup and adds an extra point of failure.
Other possibilities include: