-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
RangeError: Maximum call stack size exceeded. #3944
Comments
This looks like an existing problem with Next.js and its file tracing feature. My best guess would be that there's some recursive behaviour in its use of What did Vercel support say when you asked them? |
FYI I have the same problem. Locally the Next.js build works, but on Vercel.com not. I tried some
So IMO the Vercel.com Next.js build throws because of some change between (Note that I do not say this must be fixed in Vercel.com output:
|
Oh, I just found https://github.com/orgs/vercel/discussions/5449, and they are investigating the issue already (comment) - I suggest to close this ticket here. |
Thanks, this definitely looks like an existing Next.js problem that a sharp upgrade has exposed rather than caused. Pinning dependencies to avoid this problem is kicking the proverbial can down the road; another dependency update may come along and trigger it. Please ensure Vercel support are aware of this, and that the "accepted answer" is a temporary workaround rather than a solution. |
Given there are further reports erroneously being opened against sharp, I had a quick look at the Next.js source code and there is very clearly existing recursive behaviour within the Please see #3944 for why unbound recursion is a bad idea 😜 |
This ensures when a dependency has a recursive require our should ignore handling doesn't accidentally loop back and forth. x-ref: lovell/sharp#3944 Closes NEXT-2121
It looks like vercel/next.js#60740 uses tail-call optimisation to help solve this 🎉 |
Hi, The fix is now available in |
I ran into what seems to be a similar error, but with a different package throwing errors; not sure exactly what was causing the issue (Next or Sharp), but posting here in case someone else runs into this:
The build step was breaking on ARM macOS with Node 22, Next 14.2.1, and Sharp ^0.33.3 (worked fine in other non-macOS environments). I realized that we don't actually use any of Next's image optimization features, so I "solved" the issue by removing Sharp from the |
@liamrathke Although it might appear to be related to sharp, this issue was/is in the Please ensure you're using the latest version of If you're still having problems, you've probably run into vercel/nft#402 |
this is the solution |
pnpm run build
- executed successfully locally, but onvercel build
execution failed with these weird error:RangeError: Maximum call stack size exceeded
Error counter by
sharp
lib next use for Image Processing to serve images, By reducing the version ofsharp
0.33.2
to0.33.1
resolves the error andvercel build
executed successfully.The text was updated successfully, but these errors were encountered: