After adding Prisma to a Next.js app, every deployment fails at the end of the build:
Error: The Drift Function "api/orders" is 287.4 MB uncompressed, which exceeds the 250 MB limit.Locally the .next folder is small. What is pulling in so much?
After adding Prisma to a Next.js app, every deployment fails at the end of the build:
Error: The Drift Function "api/orders" is 287.4 MB uncompressed, which exceeds the 250 MB limit.Locally the .next folder is small. What is pulling in so much?
Usually it is every Prisma engine binary for every platform getting bundled. What does your binaryTargets look like?
@kwame.dev is right. Set binaryTargets = ["native", "rhel-openssl-3.0.x"] in your schema and add the engines folder to the function exclude list:
experimental: {
outputFileTracingExcludes: { "*": ["node_modules/@prisma/engines/**"] },
}That brings a typical function down to about 40 MB.
That was it — 38 MB now and the deploy went through. Thank you both!