vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.09k stars 26.72k forks source link

The Edge Function "middleware" size is 1.01 MB and your plan size limit is 1 MB. Though the file is 173kb #66895

Closed danielanitsa closed 2 months ago

danielanitsa commented 3 months ago

Link to the code that reproduces this issue

https://github.com/danielanitsa/book-summary-app

To Reproduce

  1. Go to my github repo named "book-summary-app"
  2. clone the repo
  3. install the dependencies and run "bun run build"

You will see: Screenshot_1

  1. Go to vercel and try to host the app

You will see this:

Screenshot_2

Current vs. Expected behavior

The expected behavior was to host the web app without any issues since I followed the docs, however I get this weird and absurd error despite not exceeding any limits that vercel puts

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #4355-Microsoft Thu Apr 12 17:37:00 PST 2024
  Available memory (MB): 16255
  Available CPU cores: 12
Binaries:
  Node: 20.14.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.2.4 // Latest available version is detected (14.2.4).
  eslint-config-next: 14.2.3
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Middleware

Which stage(s) are affected? (Select all that apply)

Vercel (Deployed)

Additional context

I switched node js versions and re-installed all the packages. I went from using v22.0.3 to v20.14.0 LTS. Also I switched from next js 14.2.2 to next js 14.2.4

Tittoh commented 3 months ago

I have this problem too after upgrading to Next.js 14.2.4

icyJoseph commented 3 months ago

Set this up: https://www.npmjs.com/package/@next/bundle-analyzer

Three browser windows will open up. One of them is the middleware bundle, what do you see there?

danielanitsa commented 3 months ago

middleware_size_screenshot

As you can see @icyJoseph , this isnt even close to 1MB that vercel says. What should I do?

icyJoseph commented 3 months ago

Ok, time to reach out to the Vercel Support team. They ought to be able to tell you why your Middleware is so large, according to their metric.

danielanitsa commented 2 months ago

Due to inactivity and impossible way to fix this, I am closing this issue. Thanks to everyone in here for contributing

github-actions[bot] commented 2 months ago

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.