Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Edge Function "map" is 1.13mb which exceeds the maximum size limit of 1mb. #32907

Closed
jlarmstrongiv opened this issue Dec 30, 2021 · 8 comments
Labels
bug Issue was opened via the bug report template.

Comments

@jlarmstrongiv
Copy link
Contributor

jlarmstrongiv commented Dec 30, 2021

What version of Next.js are you using?

12.0.7

What version of Node.js are you using?

v14.17.0

What browser are you using?

CLI

What operating system are you using?

macOS

How are you deploying your application?

vercel cli

Describe the Bug

This is an experimental feature in Next.js 12, but once enabled, SSR will use the same Edge Runtime as Middleware.

The Edge Runtime breaks my code, as:

The Edge Function "map" is 1.13mb which exceeds the maximum size limit of 1mb.

Related to #31317

Expected Behavior

I should be able to enable concurrentFeatures: true and publish my project to vercel, without triggering the different runtime.

Quite frankly, the 1mb limit is just too small. Using threejs libs, d3 libs, material-ui, and accessibility libs easily pushes me above the limit. Using next/dynamic, adding sideEffects: false, and other techniques have no effect on the size.

I also tried using cdns with nextjs like https://betterprogramming.pub/next-js-reducing-bundle-size-when-using-third-party-libraries-db5407252d59 suggests, but that did not work either.

Even if you do manage to somehow reduce the file size, then you will still run into https://github.com/vercel/vercel/discussions/6931

To Reproduce

N/A

@jlarmstrongiv jlarmstrongiv added the bug Issue was opened via the bug report template. label Dec 30, 2021
@balazsorban44
Copy link
Member

Using threejs libs, d3 libs, material-ui, and accessibility libs easily pushes me above the limit

Most npm packages probably won't work immediately, since this is not run in Node.js.

Do you have an example code of what you are trying to do that exceeds this limit?

@balazsorban44 balazsorban44 added Middleware Related to Next.js Middleware type: needs investigation and removed Middleware Related to Next.js Middleware labels Jan 5, 2022
@jlarmstrongiv
Copy link
Contributor Author

@balazsorban44 Funny you say that, I actually have to keep all the NodeJS code separated anyway, otherwise it’ll just crash. It’s going over the limit by bundling browser libs at 1.13mb for a visualization.

For investigation, can I give you a link to a Vercel failed build? Is there a way to download the Vercel failed build source? The build is actually part of a larger homegrown monorepo with tooling that will not be easy to separate and share.

@nyinyithann
Copy link

I am also getting the following error when i turn on concurrentFeatures: true and deploy to vercel.

Error: The Edge Function "index" is 1.66mb which exceeds the maximum size limit of 1mb. Learn More: https://vercel.link/edge-function-size

@Ali-Hussein-dev
Copy link

Having the same issue after upgrading to 12.0.10

clients – Deployment Overview

@balazsorban44
Copy link
Member

balazsorban44 commented Feb 9, 2022

@Ali-Hussein-dev are you able to share the api/_middleware so we can see what dependencies are you using? Do you have any concurrent features enabled? Your case might be a bug with the size calculation.

Could you open a separate issue for this?

@Ali-Hussein-dev
Copy link

@balazsorban44 here is the link to the issue with the code #34201

@shuding
Copy link
Member

shuding commented Aug 15, 2022

Closing this as we shipped a lot of optimizations recently:

Let us know if you are still running into this issue and we can reopen it, thanks!

@shuding shuding closed this as completed Aug 15, 2022
@github-actions
Copy link
Contributor

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

5 participants