Codify SaaS Blog - Page 3
Code-first guides and deep dives on building B2B SaaS products, designing APIs, scaling web apps, and modernizing legacy software.

Prisma Migration Drift Detected After Manual Schema Change on Managed Postgres
You ran a quick ALTER TABLE straight from your managed Postgres dashboard during an incident, meant to circle back and add a proper migration later. Now prisma migrate dev refuses to run at all, insisting your migration history doesn't match reality — because it doesn't, and Prisma noticed before you did.

Prisma Timeout Errors on Supabase Pooler (Transaction vs Session Mode)
One or two users, everything is fine. Real concurrent traffic hits, and Prisma starts timing out waiting for a connection to Supabase that never comes. Nothing about your query changed — you're just on the pooler mode that hands out far fewer usable slots than you think, and Supabase's own port assignments have changed enough recently that a lot of setup guides are already out of date.

Prisma Edge Runtime Error in Vercel Middleware — The Real Fix
The exact same PrismaClient import that works everywhere else in your Next.js app throws the moment it runs inside middleware. It's not a typo, and it's not a missing environment variable — Next.js middleware runs on the Edge runtime by default, and Prisma's default setup was never built to run there.

Prisma Client Not Found After Deploying to Render
Locally, `prisma generate` ran once, ages ago, and you've never thought about it since. On Render, the exact same code throws a module-not-found error the instant the app tries to touch the database — because generating the client isn't a one-time local ritual, it's a build step Render has no reason to know about unless you tell it.

Prisma Migrate Failing on Railway — Shadow Database Permission Denied
prisma migrate dev worked fine yesterday, and today it's throwing a permission error about a database you never asked it to create. It's not your migration, and it's not a Railway outage — Prisma silently creates and drops a temporary shadow database on every migrate dev run, and your database role doesn't have permission to create one.

Prisma Connection Pool Exhausted on Vercel Serverless Functions — The Real Fix
The API works fine in staging, then a real traffic burst hits production and Postgres starts throwing 'too many connections' or Prisma just times out waiting for one. Nothing in your query changed. Vercel just spun up more function instances than your database has connections to give them.

Prisma "Prepared Statement Already Exists" With PgBouncer — The Real Fix
The query worked five minutes ago. Now every other request throws 'prepared statement "s0" already exists' and nothing in your Prisma schema changed. It's not a Prisma bug — it's PgBouncer's transaction-mode pooling colliding with the prepared statements Prisma's query engine creates by default.

NestJS + Docker on AWS ECS — Health Check Passing Locally, Failing in Production
Your container is healthy in docker run, the app responds fine if you exec into the task and curl it yourself, and ECS still cycles it as unhealthy every few minutes. It's rarely the health check command itself — it's usually a networking layer between ECS and your container that curl-from-inside never has to cross.

NestJS Static Assets 404 After Deploying to Render
Every image, stylesheet, and static file loads fine on your machine and 404s the second the app runs on Render. It's rarely ServeStaticModule itself — it's a path that only ever resolved correctly in the one directory structure you happened to be building from locally.

NestJS File Upload Failing on Vercel — The 4.5MB Body Limit Nobody Documents
Uploads under a couple of megabytes work fine. Anything bigger fails with no useful error, only once the app is deployed to Vercel. It's not Multer, and it's not your validation logic — Vercel caps serverless function request bodies at 4.5MB, and no config flag raises it.

NestJS GraphQL Subscriptions Not Working Behind Cloudflare
Your GraphQL subscription connects, sits for a moment, and closes — every time, only in production, only once Cloudflare is in front of the app. It's not your resolver. Cloudflare's proxy has opinions about long-lived connections, and by default those opinions don't include yours.

NestJS Microservices on Railway — TCP Transport Connection Refused
Two NestJS microservices, deployed to Railway, refusing to talk to each other with ECONNREFUSED — while both are clearly running. It's rarely your TCP transport config. It's almost always public URLs and an IPv4/IPv6 mismatch on Railway's private network.