mailing: Cannot deploy to Vercel - max serverless function size reached

After updating mailing to 0.8.13 I’m unable to deploy it on Vercel, I’m getting a following output:

[23:09:24.788] Warning: Max serverless function size of 50 MB compressed or 250 MB uncompressed reached
[23:09:24.789] Serverless Function's page: settings.js
[23:09:24.796] Large Dependencies                          Uncompressed size  Compressed size
[23:09:24.796] apps/mailing/.mailing                                 45.7 MB          15.8 MB
[23:09:24.796] node_modules/@swc/core-linux-x64-gnu                  43.6 MB          14.6 MB
[23:09:24.796] node_modules/@swc/core-linux-x64-musl                 43.1 MB          14.4 MB
[23:09:24.797] node_modules/esbuild-linux-64/bin                     8.15 MB          3.44 MB
[23:09:24.797] node_modules/next/dist                                8.07 MB          2.15 MB
[23:09:24.797] node_modules/prettier/parser-typescript.js            3.58 MB           942 kB
[23:09:24.797] node_modules/webpack/lib                              3.35 MB           861 kB
[23:09:24.797] node_modules/react-dom/cjs                            1.72 MB           414 kB
[23:09:24.797] node_modules/prettier/index.js                         1.4 MB           261 kB
[23:09:24.797] node_modules/prettier/parser-flow.js                  1.05 MB           236 kB
[23:09:24.798] node_modules/terser/dist                               956 kB           183 kB
[23:09:24.798] node_modules/uglify-js/lib                             995 kB           170 kB
[23:09:24.798] node_modules/lodash/lodash.js                          544 kB          96.4 kB
[23:09:24.798] node_modules/webpack/schemas                           565 kB          88.5 kB
[23:09:24.798] 
[23:09:24.798] All dependencies                                       168 MB            55 MB
[23:09:24.799] Serverless Function's page: signup.js
[23:09:24.801] Large Dependencies                     Uncompressed size  Compressed size
[23:09:24.802] apps/mailing/.mailing                            45.6 MB          15.8 MB
[23:09:24.802] node_modules/@swc/core-linux-x64-gnu             43.6 MB          14.6 MB
[23:09:24.802] node_modules/@swc/core-linux-x64-musl            43.1 MB          14.4 MB
[23:09:24.802] node_modules/esbuild-linux-64/bin                8.15 MB          3.44 MB
[23:09:24.802] node_modules/next/dist                           8.07 MB          2.15 MB
[23:09:24.802] node_modules/webpack/lib                         3.35 MB           861 kB
[23:09:24.802] node_modules/react-dom/cjs                       1.72 MB           414 kB
[23:09:24.803] node_modules/terser/dist                          956 kB           183 kB
[23:09:24.803] node_modules/uglify-js/lib                        995 kB           170 kB
[23:09:24.803] node_modules/webpack/schemas                      565 kB          88.5 kB
[23:09:24.803] 
[23:09:24.803] All dependencies                                  159 MB          52.8 MB
[23:09:24.803] Serverless Function's page: api/apiKeys.js
[23:09:24.807] Large Dependencies                          Uncompressed size  Compressed size
[23:09:24.807] apps/mailing/.mailing                                 45.7 MB          15.8 MB
[23:09:24.807] node_modules/@swc/core-linux-x64-gnu                  43.6 MB          14.6 MB
[23:09:24.808] node_modules/@swc/core-linux-x64-musl                 43.1 MB          14.4 MB
[23:09:24.808] node_modules/esbuild-linux-64/bin                     8.15 MB          3.44 MB
[23:09:24.808] node_modules/next/dist                                8.07 MB          2.15 MB
[23:09:24.808] node_modules/prettier/parser-typescript.js            3.58 MB           942 kB
[23:09:24.808] node_modules/webpack/lib                              3.35 MB           861 kB
[23:09:24.808] node_modules/react-dom/cjs                            1.72 MB           414 kB
[23:09:24.808] node_modules/prettier/index.js                         1.4 MB           261 kB
[23:09:24.808] node_modules/prettier/parser-flow.js                  1.05 MB           236 kB
[23:09:24.808] node_modules/terser/dist                               956 kB           183 kB
[23:09:24.808] node_modules/uglify-js/lib                             995 kB           170 kB
[23:09:24.808] node_modules/lodash/lodash.js                          544 kB          96.4 kB
[23:09:24.808] node_modules/webpack/schemas                           565 kB          88.5 kB
[23:09:24.808] 
[23:09:24.808] All dependencies                                       168 MB            55 MB
[23:09:24.808] Serverless Function's page: api/hooks/click.js
[23:09:24.813] Large Dependencies                          Uncompressed size  Compressed size
[23:09:24.813] apps/mailing/.mailing                                 45.7 MB          15.8 MB
[23:09:24.813] node_modules/@swc/core-linux-x64-gnu                  43.6 MB          14.6 MB
[23:09:24.813] node_modules/@swc/core-linux-x64-musl                 43.1 MB          14.4 MB
[23:09:24.813] node_modules/esbuild-linux-64/bin                     8.15 MB          3.44 MB
[23:09:24.813] node_modules/next/dist                                8.07 MB          2.15 MB
[23:09:24.813] node_modules/prettier/parser-typescript.js            3.58 MB           942 kB
[23:09:24.814] node_modules/webpack/lib                              3.35 MB           861 kB
[23:09:24.814] node_modules/react-dom/cjs                            1.72 MB           414 kB
[23:09:24.814] node_modules/prettier/index.js                         1.4 MB           261 kB
[23:09:24.814] node_modules/prettier/parser-flow.js                  1.05 MB           236 kB
[23:09:24.814] node_modules/terser/dist                               956 kB           183 kB
[23:09:24.814] node_modules/uglify-js/lib                             995 kB           170 kB
[23:09:24.814] node_modules/lodash/lodash.js                          544 kB          96.4 kB
[23:09:24.814] node_modules/webpack/schemas                           565 kB          88.5 kB
[23:09:24.814] 
[23:09:24.814] All dependencies                                       168 MB          54.9 MB
[23:09:24.816] Serverless Function's page: api/hooks/open.js
[23:09:24.820] Large Dependencies                          Uncompressed size  Compressed size
[23:09:24.821] apps/mailing/.mailing                                 45.7 MB          15.8 MB
[23:09:24.821] node_modules/@swc/core-linux-x64-gnu                  43.6 MB          14.6 MB
[23:09:24.821] node_modules/@swc/core-linux-x64-musl                 43.1 MB          14.4 MB
[23:09:24.821] node_modules/esbuild-linux-64/bin                     8.15 MB          3.44 MB
[23:09:24.822] node_modules/next/dist                                8.07 MB          2.15 MB
[23:09:24.822] node_modules/prettier/parser-typescript.js            3.58 MB           942 kB
[23:09:24.822] node_modules/webpack/lib                              3.35 MB           861 kB
[23:09:24.822] node_modules/react-dom/cjs                            1.72 MB           414 kB
[23:09:24.822] node_modules/prettier/index.js                         1.4 MB           261 kB
[23:09:24.823] node_modules/prettier/parser-flow.js                  1.05 MB           236 kB
[23:09:24.823] node_modules/terser/dist                               956 kB           183 kB
[23:09:24.823] node_modules/uglify-js/lib                             995 kB           170 kB
[23:09:24.823] node_modules/lodash/lodash.js                          544 kB          96.4 kB
[23:09:24.823] node_modules/webpack/schemas                           565 kB          88.5 kB
[23:09:24.824] 
[23:09:24.824] All dependencies                                       168 MB          54.9 MB
[23:09:24.824] Serverless Function's page: api/lists.js
[23:09:24.827] Large Dependencies                          Uncompressed size  Compressed size
[23:09:24.827] apps/mailing/.mailing                                 45.7 MB          15.8 MB
[23:09:24.827] node_modules/@swc/core-linux-x64-gnu                  43.6 MB          14.6 MB
[23:09:24.827] node_modules/@swc/core-linux-x64-musl                 43.1 MB          14.4 MB
[23:09:24.827] node_modules/esbuild-linux-64/bin                     8.15 MB          3.44 MB
[23:09:24.828] node_modules/next/dist                                8.07 MB          2.15 MB
[23:09:24.828] node_modules/prettier/parser-typescript.js            3.58 MB           942 kB
[23:09:24.828] node_modules/webpack/lib                              3.35 MB           861 kB
[23:09:24.828] node_modules/react-dom/cjs                            1.72 MB           414 kB
[23:09:24.830] node_modules/prettier/index.js                         1.4 MB           261 kB
[23:09:24.830] node_modules/prettier/parser-flow.js                  1.05 MB           236 kB
[23:09:24.830] node_modules/terser/dist                               956 kB           183 kB
[23:09:24.830] node_modules/uglify-js/lib                             995 kB           170 kB
[23:09:24.830] node_modules/lodash/lodash.js                          544 kB          96.4 kB
[23:09:24.831] node_modules/webpack/schemas                           565 kB          88.5 kB
[23:09:24.831] 
[23:09:24.831] All dependencies                                       168 MB            55 MB
[23:09:24.831] Serverless Function's page: api/lists/[id]/members.js
[23:09:24.833] Large Dependencies                          Uncompressed size  Compressed size
[23:09:24.834] apps/mailing/.mailing                                 45.7 MB          15.8 MB
[23:09:24.834] node_modules/@swc/core-linux-x64-gnu                  43.6 MB          14.6 MB
[23:09:24.835] node_modules/@swc/core-linux-x64-musl                 43.1 MB          14.4 MB
[23:09:24.835] node_modules/esbuild-linux-64/bin                     8.15 MB          3.44 MB
[23:09:24.836] node_modules/next/dist                                8.07 MB          2.15 MB
[23:09:24.836] node_modules/prettier/parser-typescript.js            3.58 MB           942 kB
[23:09:24.836] node_modules/webpack/lib                              3.35 MB           861 kB
[23:09:24.836] node_modules/react-dom/cjs                            1.72 MB           414 kB
[23:09:24.837] node_modules/prettier/index.js                         1.4 MB           261 kB
[23:09:24.837] node_modules/prettier/parser-flow.js                  1.05 MB           236 kB
[23:09:24.837] node_modules/terser/dist                               956 kB           183 kB
[23:09:24.837] node_modules/uglify-js/lib                             995 kB           170 kB
[23:09:24.838] node_modules/lodash/lodash.js                          544 kB          96.4 kB
[23:09:24.838] node_modules/webpack/schemas                           565 kB          88.5 kB
[23:09:24.838] 
[23:09:24.839] Serverless Function's page: api/lists/[id]/members/[memberId].js
[23:09:24.840] Large Dependencies                          Uncompressed size  Compressed size
[23:09:24.840] apps/mailing/.mailing                                 45.7 MB          15.8 MB
[23:09:24.841] node_modules/@swc/core-linux-x64-gnu                  43.6 MB          14.6 MB
[23:09:24.841] node_modules/@swc/core-linux-x64-musl                 43.1 MB          14.4 MB
[23:09:24.841] node_modules/esbuild-linux-64/bin                     8.15 MB          3.44 MB
[23:09:24.841] node_modules/next/dist                                8.07 MB          2.15 MB
[23:09:24.841] node_modules/prettier/parser-typescript.js            3.58 MB           942 kB
[23:09:24.841] node_modules/webpack/lib                              3.35 MB           861 kB
[23:09:24.842] node_modules/react-dom/cjs                            1.72 MB           414 kB
[23:09:24.842] node_modules/prettier/index.js                         1.4 MB           261 kB
[23:09:24.842] node_modules/prettier/parser-flow.js                  1.05 MB           236 kB
[23:09:24.842] node_modules/terser/dist                               956 kB           183 kB
[23:09:24.842] node_modules/uglify-js/lib                             995 kB           170 kB
[23:09:24.843] node_modules/lodash/lodash.js                          544 kB          96.4 kB
[23:09:24.843] node_modules/webpack/schemas                           565 kB          88.5 kB
[23:09:24.843] 
[23:09:24.843] All dependencies                                       168 MB            55 MB
[23:09:24.844] Serverless Function's page: api/messages.js
[23:09:24.846] Large Dependencies                     Uncompressed size  Compressed size
[23:09:24.846] apps/mailing/.mailing                            45.7 MB          15.8 MB
[23:09:24.846] node_modules/@swc/core-linux-x64-gnu             43.6 MB          14.6 MB
[23:09:24.846] node_modules/@swc/core-linux-x64-musl            43.1 MB          14.4 MB
[23:09:24.847] node_modules/esbuild-linux-64/bin                8.15 MB          3.44 MB
[23:09:24.847] node_modules/next/dist                           8.07 MB          2.15 MB
[23:09:24.847] node_modules/webpack/lib                         3.35 MB           861 kB
[23:09:24.847] node_modules/react-dom/cjs                       1.72 MB           414 kB
[23:09:24.847] node_modules/terser/dist                          956 kB           183 kB
[23:09:24.848] node_modules/uglify-js/lib                        995 kB           170 kB
[23:09:24.848] node_modules/webpack/schemas                      565 kB          88.5 kB
[23:09:24.848] 
[23:09:24.848] All dependencies                                  159 MB          52.8 MB
[23:09:24.849] Serverless Function's page: api/sendMail.js
[23:09:24.855] Large Dependencies                     Uncompressed size  Compressed size
[23:09:24.855] apps/mailing/.mailing                            46.4 MB            16 MB
[23:09:24.856] node_modules/@swc/core-linux-x64-gnu             43.6 MB          14.6 MB
[23:09:24.856] node_modules/@swc/core-linux-x64-musl            43.1 MB          14.4 MB
[23:09:24.856] node_modules/esbuild-linux-64/bin                8.15 MB          3.44 MB
[23:09:24.856] node_modules/next/dist                           8.07 MB          2.15 MB
[23:09:24.856] node_modules/webpack/lib                         3.35 MB           861 kB
[23:09:24.856] node_modules/react-dom/cjs                       2.28 MB           558 kB
[23:09:24.856] node_modules/juice/node_modules                   811 kB           186 kB
[23:09:24.856] node_modules/terser/dist                          956 kB           183 kB
[23:09:24.856] node_modules/uglify-js/lib                        995 kB           170 kB
[23:09:24.857] node_modules/react-reconciler/cjs                 722 kB           163 kB
[23:09:24.857] node_modules/webpack/schemas                      565 kB          88.5 kB
[23:09:24.857] 
[23:09:24.857] All dependencies                                  166 MB          54.5 MB
[23:09:24.857] Serverless Function's page: api/session.js
[23:09:24.861] Large Dependencies                          Uncompressed size  Compressed size
[23:09:24.861] apps/mailing/.mailing                                 45.7 MB          15.8 MB
[23:09:24.861] node_modules/@swc/core-linux-x64-gnu                  43.6 MB          14.6 MB
[23:09:24.861] node_modules/@swc/core-linux-x64-musl                 43.1 MB          14.4 MB
[23:09:24.861] node_modules/esbuild-linux-64/bin                     8.15 MB          3.44 MB
[23:09:24.861] node_modules/next/dist                                8.07 MB          2.15 MB
[23:09:24.862] node_modules/prettier/parser-typescript.js            3.58 MB           942 kB
[23:09:24.862] node_modules/webpack/lib                              3.35 MB           861 kB
[23:09:24.862] node_modules/react-dom/cjs                            1.72 MB           414 kB
[23:09:24.862] node_modules/prettier/index.js                         1.4 MB           261 kB
[23:09:24.862] node_modules/prettier/parser-flow.js                  1.05 MB           236 kB
[23:09:24.862] node_modules/terser/dist                               956 kB           183 kB
[23:09:24.862] node_modules/uglify-js/lib                             995 kB           170 kB
[23:09:24.862] node_modules/lodash/lodash.js                          544 kB          96.4 kB
[23:09:24.862] node_modules/webpack/schemas                           565 kB          88.5 kB
[23:09:24.862] 
[23:09:24.863] All dependencies                                       169 MB          55.3 MB
[23:09:24.863] Serverless Function's page: api/users.js
[23:09:24.866] Large Dependencies                     Uncompressed size  Compressed size
[23:09:24.866] apps/mailing/.mailing                            45.6 MB          15.8 MB
[23:09:24.866] node_modules/@swc/core-linux-x64-gnu             43.6 MB          14.6 MB
[23:09:24.867] node_modules/@swc/core-linux-x64-musl            43.1 MB          14.4 MB
[23:09:24.868] node_modules/esbuild-linux-64/bin                8.15 MB          3.44 MB
[23:09:24.868] node_modules/next/dist                           8.07 MB          2.15 MB
[23:09:24.868] node_modules/webpack/lib                         3.35 MB           861 kB
[23:09:24.868] node_modules/react-dom/cjs                       1.72 MB           414 kB
[23:09:24.868] node_modules/terser/dist                          956 kB           183 kB
[23:09:24.868] node_modules/uglify-js/lib                        995 kB           170 kB
[23:09:24.868] node_modules/webpack/schemas                      565 kB          88.5 kB
[23:09:24.868] 
[23:09:24.868] All dependencies                                  160 MB          53.1 MB
[23:09:24.869] Max serverless function size was exceeded for 12 functions
[23:09:24.899] Created all serverless functions in: 11.375s
[23:09:24.918] Collected static files (public/, static/, .next/static): 14.43ms

It seems like Vercel complains specifically about /api/apiKeys page:

The Serverless Function "api/apiKeys" is 53.05mb which exceeds the maximum size limit of 50mb.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18

Most upvoted comments

It worked! next@13.0.3-canary.0 and mailing@0.8.14 is the perfect match. Thank you! 🙂

Hey! I got the same issue and solved it by upgrade to next@13.0.3-canary.0

Thanks for the response. I’m deploying using the official Vercel <-> Github integration, I’ve got a mailing-based app within a monorepo. Nothing fancy - here’s the relevant part of my app’s package.json:

  "scripts": {
    "dev": "mailing preview",
    "export": "mailing export-previews",
    "build": "mailing server build",
    "start": "mailing server start"
  },
  "dependencies": {
    "clsx": "1.2.1",
    "mailing": "0.8.13",
    "mailing-core": "0.8.13",
    "mjml": "4.13.0",
    "mjml-react": "2.0.8",
    "next": "13.0.1",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  },
  "devDependencies": {
    "@types/yargs": "17.0.13"
  }

Here’s the Vercel project’s build step:

  cd ../.. && yarn build --filter=@xxx/mailing...

and the relevant part of the turborepo’s config:

    "@xxx/mailing#build": {
      "outputs": [".mailing/**"],
      "env": ["MAILING_SENDGRID_API_KEY"]
    },

I’m seeing those errors within Vercel’s deployment page: Zrzut ekranu 2022-11-6 o 14 11 34

Dang! @klapec will you please try bumping the mailing and mailing-core version to latest as well (0.8.14)? One dependency was removed so perhaps it’s smaller (though I still haven’t been able to repro to confirm).