Description
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
This is from a Vercel build. I've added the output below:
> my-app@0.1.2 next:info
--
11:16:16.723 | > next info
11:16:16.723 |
11:16:17.698 |
11:16:17.699 | Operating System:
11:16:17.699 | Platform: linux
11:16:17.699 | Arch: x64
11:16:17.699 | Version: #1 SMP Thu Sep 29 01:01:23 UTC 2022
11:16:17.699 | Binaries:
11:16:17.699 | Node: 14.20.0
11:16:17.699 | npm: 8.11.0
11:16:17.699 | Yarn: 1.22.17
11:16:17.699 | pnpm: 6.35.0
11:16:17.700 | Relevant packages:
11:16:17.700 | next: 13.0.3-canary.1
11:16:17.700 | eslint-config-next: 13.0.2
11:16:17.700 | react: 18.2.0
11:16:17.700 | react-dom: 18.2.0
All serverless functions suffer this. Here's an example:
Warning: Max serverless function size of 50 MB compressed or 250 MB uncompressed reached
--
11:16:47.301 | Serverless Function's page: 404.js
11:16:47.307 | Large Dependencies Uncompressed size Compressed size
11:16:47.308 | node_modules/.prisma/client 44.9 MB 15.6 MB
11:16:47.308 | node_modules/@swc/core-linux-x64-gnu 43.1 MB 14.4 MB
11:16:47.308 | node_modules/@swc/core-linux-x64-musl 42.7 MB 14.3 MB
11:16:47.308 | node_modules/next/dist 8.2 MB 2.19 MB
11:16:47.308 | node_modules/webpack/lib 3.3 MB 848 kB
11:16:47.308 | node_modules/react-dom/cjs 1.72 MB 414 kB
11:16:47.308 | node_modules/@prisma/client 1.23 MB 267 kB
11:16:47.308 | node_modules/terser/dist 959 kB 183 kB
11:16:47.308 | node_modules/libphonenumber-js/build 355 kB 118 kB
11:16:47.309 | node_modules/libphonenumber-js/es6 326 kB 108 kB
11:16:47.309 | .next/server/chunks 469 kB 108 kB
11:16:47.309 | node_modules/webpack/schemas 559 kB 87.8 kB
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
Our NextJS on Vercel no longer are deployable as of NextJS 13.0.2
due to exceeding the max payload size of Serverless functions.
Here's an example of the basic 404 page (which does not do any Prisma-related queries):
Warning: Max serverless function size of 50 MB compressed or 250 MB uncompressed reached
--
11:16:47.301 | Serverless Function's page: 404.js
11:16:47.307 | Large Dependencies Uncompressed size Compressed size
11:16:47.308 | node_modules/.prisma/client 44.9 MB 15.6 MB
11:16:47.308 | node_modules/@swc/core-linux-x64-gnu 43.1 MB 14.4 MB
11:16:47.308 | node_modules/@swc/core-linux-x64-musl 42.7 MB 14.3 MB
11:16:47.308 | node_modules/next/dist 8.2 MB 2.19 MB
11:16:47.308 | node_modules/webpack/lib 3.3 MB 848 kB
11:16:47.308 | node_modules/react-dom/cjs 1.72 MB 414 kB
11:16:47.308 | node_modules/@prisma/client 1.23 MB 267 kB
11:16:47.308 | node_modules/terser/dist 959 kB 183 kB
11:16:47.308 | node_modules/libphonenumber-js/build 355 kB 118 kB
11:16:47.309 | node_modules/libphonenumber-js/es6 326 kB 108 kB
11:16:47.309 | .next/server/chunks 469 kB 108 kB
11:16:47.309 | node_modules/webpack/schemas 559 kB 87.8 kB
Why are two versions of SWC core being included? I think that's the main culprit.
Here is an open ticket in the SWC project that highlights how both gnu
and musl
libraries are included. Is there anything we can do to pick a single one for Vercel builds?
I noticed in the 13.02
release notes that Prisma being added to externals list. Could this be a side effect as well?
Expected Behavior
Serverless functions do not include both gnu
and musl
and do not exceed the threshold for deployment on Vercel.
NextJS version 13.0.1
succeeds.
Link to reproduction
https://github.com/erawk/next-app-bug-report-serverless-functions-payload-size
To Reproduce
- Create a new NextJS app
- Add in Prisma with a basic schema
- Build a serverless function page
- Observe both Prisma, @swc/core for both
musl
andgnu
included