question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@prisma/engines weights 113 MB and causes maximum size limit error on Vercel

See original GitHub issue

Bug description

When I try to deploy a Next.js + GraphQL + Prisma application on Vercel I receive an error about exceeding the lambda function limit.

23:15:50.190  	Max serverless function size of 50 MB compressed or 250 MB uncompressed hit
23:15:50.190  	Serverless Function's page: api/graphql.js
23:15:50.191  	Large Dependencies                          Uncompressed size  Compressed size
23:15:50.191  	node_modules/@prisma/engines                           113 MB          39.6 MB
23:15:50.191  	node_modules/.prisma/client                           45.9 MB          16.1 MB
23:15:50.191  	node_modules/prisma/build                             5.27 MB          1.09 MB

Full log here: https://gist.github.com/talentlessguy/74f58664cd5af05407037be15b3b25a1

How to reproduce

  1. Create a new Next.js project with these files: https://gist.github.com/talentlessguy/9cac915be4fa6a1ea911c7f0ead5fa2b

Expected behavior

I expected a Next.js app to build and launch as it usually does (it did run fine 1-2 weeks ago)

Prisma information

Schema: https://gist.github.com/talentlessguy/9cac915be4fa6a1ea911c7f0ead5fa2b#file-graphql_schema-ts

Environment & setup

  • OS: Vercel Linux runtime
  • Database: PostgreSQL
  • Node.js version: 14.16
  • Prisma version: 2.22.0
prisma               : 2.22.0
@prisma/client       : 2.22.0
Current platform     : debian-openssl-1.1.x
Query Engine         : query-engine 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules/.pnpm/@prisma+engines@2.22.0-21.60cc71d884972ab4e897f0277c4b84383dddaf6c/node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine     : migration-engine-cli 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules/.pnpm/@prisma+engines@2.22.0-21.60cc71d884972ab4e897f0277c4b84383dddaf6c/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules/.pnpm/@prisma+engines@2.22.0-21.60cc71d884972ab4e897f0277c4b84383dddaf6c/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary        : prisma-fmt 60cc71d884972ab4e897f0277c4b84383dddaf6c (at node_modules/.pnpm/@prisma+engines@2.22.0-21.60cc71d884972ab4e897f0277c4b84383dddaf6c/node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash : 60cc71d884972ab4e897f0277c4b84383dddaf6c
Studio               : 0.379.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:44 (24 by maintainers)

github_iconTop GitHub Comments

14reactions
janpiocommented, May 18, 2021

Ok, so we figured out what is going on here and I need to document that for later:

  • This was indeed caused by a change in Prisma CLI (Prisma Studio more exactly) between 2.22.0-dev.39 and 2.22.0-dev.40 - and was shipped with 2.22.0.
  • Our end to end tests did not trigger the failure, as it only appears in relation with nexus-plugin-prisma - which you are all using in your projects.
  • We could easily fix the problem in Prisma CLI already which we did in early 2.23.0-dev, which will of course also be included in 2.23.0.
  • Left us with the problem that we did not understand what is going on in nexus-plugin-prisma what triggered this bug in the CLI to become active.
  • After help from Vercel we could confirm that 1 specific line in nexus-plugin-prisma led to Prisma Client Postinstall and via that Prisma CLI and via that Prisma studio was triggered: https://github.com/vercel/nft/issues/203#issuecomment-840541429
  • We could also confirm that a simple change in nexus-plugin-prisma could break that inclusion: https://github.com/graphql-nexus/nexus-plugin-prisma/pull/1089/files Our reproduction project can successfully be published on Vercel when we change the nexus-plugin-prisma dependency to that PR version: https://github.com/janpio/prisma-limit-repro/pull/11/files

Case closed. 📕

Left to do now is to maybe clean up nexus-plugin-prisma a bit and certainly add our reproduction project (Thanks @talentlessguy again!!) to our e2e tests with the failing dependency versions, then update to recent ones to make sure the problems are gone and will never come back (in this one specific combination).

5reactions
janpiocommented, May 8, 2021

Yes, now I have a reproduction that I can poke.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I bypass the 4.5MB body size limit of Vercel ...
When trying to request or upload a large file from a Serverless Function, you may have seen a 413: FUNCTION_PAYLOAD_TOO_LARGE error.
Read more >
NextJs: The Serverless Function exceeds the maximum size ...
It appears that when bundling the serverless function vercel is pulling in ALL assets within your project. So 50.55MB is likely the size...
Read more >
File Size limit exceeded when trying to deploy app ... - Reddit
gitignore file. This means the deployment build will fail when importing the project in vercel's website since there is no assets folder. So...
Read more >
Serverless Function exceeds the maximum size limit of 50mb
I'm trying to deploy a Flask REST API on Vercel, and in my latest commit, ... Error: The Serverless Function "index.py" is 79.31mb...
Read more >
GolangRepo: Discover useful Go development resources
merry Add context to errors, including automatic stack capture, cause chains, ... Limits the concurrency of task execution, not the number of tasks...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found