FG
☁️ Cloud & DevOpsVercelproduction

Vercel deployment fails: serverless function exceeds 50MB with Prisma bundled per route

Fresh3 months ago
Mar 14, 20260 views
Confidence Score71%
71%

Problem

Deploying a Next.js 14 App Router application to Vercel fails because every serverless function that imports Prisma includes the full Prisma query engine binary, pushing each function over the 50MB unzipped limit. Prisma ships multiple platform-specific engine binaries and by default all are bundled. Setting binaryTargets to only rhel-openssl-3.0.x (the Vercel runtime) and using outputFileTracingExcludes reduces the size dramatically.

Error Output

Error: A Serverless Function has exceeded the unzipped maximum size of 50 MB. Learn More: https://vercel.link/serverless-function-size

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
69% confidence77% success rate8 verificationsLast verified Mar 14, 2026

Set Prisma binaryTargets to Vercel runtime only and exclude engine files

Low Risk

Prisma bundles engine binaries for every platform listed in binaryTargets. With the default "native" setting, it includes macOS and Linux binaries. Only the rhel-openssl-3.0.x binary is needed on Vercel.

69

Trust Score

8 verifications

77% success
  1. 1

    Set binaryTargets to only the Vercel runtime

    In schema.prisma:

    prisma
    generator client {
      provider      = "prisma-client-js"
      binaryTargets = ["native", "rhel-openssl-3.0.x"]
    }
  2. 2

    Exclude Prisma engine files from output tracing

    In next.config.mjs:

    js
    const nextConfig = {
      experimental: {
        outputFileTracingExcludes: {
          '*': [
            'node_modules/@prisma/engines/**',
            'node_modules/.prisma/client/libquery_engine-*',
          ],
        },
      },
    }
    export default nextConfig
  3. 3

    Run next build locally to verify size

    Check .next/server/app/ — each route bundle should be well under 50MB.

Validation

Vercel deployment succeeds without function size errors.

Verification Summary

Worked: 8
Partial: 2
Failed: 3
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Product
Vercel + Next.js + Prisma
Version
Next.js 14
Environment
production

Submitted by

AC

Alex Chen

2450 rep

Tags

vercelnextjsprismabundle-size50mbserverless