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

Maximum call stack size exceeded #56614

Closed
1 task done
Deeds67 opened this issue Oct 9, 2023 · 16 comments · Fixed by #56770
Closed
1 task done

Maximum call stack size exceeded #56614

Deeds67 opened this issue Oct 9, 2023 · 16 comments · Fixed by #56770
Assignees
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. locked

Comments

@Deeds67
Copy link

Deeds67 commented Oct 9, 2023

Link to the code that reproduces this issue

https://github.com/Deeds67/nextjs-max-call-stack-size-exceeded

To Reproduce

  1. Add dependency "@material-tailwind/react": "^2.1.0",
  2. Create a NavbarDefault component as listed here: https://www.material-tailwind.com/docs/react/navbar#navbar
  3. Render this component on a page
  4. Run npm run build

Current vs. Expected behavior

Current behavior:

Build fails with the following error:
RangeError: Maximum call stack size exceeded

Expected behavior: Build should successfully pass.

Here's the full error output:

✗ npm run build

> max-call-stack-error@0.1.0 build
> next build

 ✓ Creating an optimized production build    
 ✓ Compiled successfully
 ✓ Linting and checking validity of types    
 ✓ Collecting page data    
   Generating static pages (0/5)  [    ]RangeError: Maximum call stack size exceeded
    at P (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:231722)
    at l (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:227295)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228496
    at Array.forEach (<anonymous>)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228469
    at Array.forEach (<anonymous>)
    at a (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228289)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228553
    at Array.forEach (<anonymous>)
    at l (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228246)

Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
RangeError: Maximum call stack size exceeded
    at P (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:231722)
    at l (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:227295)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228496
    at Array.forEach (<anonymous>)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228469
    at Array.forEach (<anonymous>)
    at a (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228289)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228553
    at Array.forEach (<anonymous>)
    at l (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228246)
RangeError: Maximum call stack size exceeded
    at P (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:231722)
    at l (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:227295)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228496
    at Array.forEach (<anonymous>)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228469
    at Array.forEach (<anonymous>)
    at a (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228289)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228553
    at Array.forEach (<anonymous>)
    at l (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228246)

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
RangeError: Maximum call stack size exceeded
    at P (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:231722)
    at l (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:227295)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228496
    at Array.forEach (<anonymous>)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228469
    at Array.forEach (<anonymous>)
    at a (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228289)
    at /home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228553
    at Array.forEach (<anonymous>)
    at l (/home/pierre/dev/ts/max-call-stack-error/.next/server/chunks/241.js:5:228246)
 ✓ Generating static pages (5/5) 

> Export encountered errors on following paths:
	/_not-found
	/page: /

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #202309191142~1695998943~22.04~070916d SMP PREEMPT_DYNAMIC Fri S
Binaries:
  Node: 20.3.1
  npm: 9.6.7
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 13.5.5-canary.4
  eslint-config-next: 13.5.4
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

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

Not sure

Additional context

App works when running npm run dev, but not when building a production ready app using npm run build

WEB-1744

@Deeds67 Deeds67 added the bug Issue was opened via the bug report template. label Oct 9, 2023
@balazsorban44 balazsorban44 added linear: turbopack Confirmed issue that is tracked by the Turbopack team. area: SWC Minify labels Oct 9, 2023
@balazsorban44
Copy link
Member

Thanks, I believe this was a regression that slipped in in https://github.com/vercel/next.js/releases/tag/v13.5.4-canary.9 via #56281

We will have a look!

@sheldon-welinga
Copy link

sheldon-welinga commented Oct 9, 2023

I think it's an issue related to @material-tailwind/react library. If you remove it. Your project builds' properly

Also, see the open issue #468

@kdy1 kdy1 self-assigned this Oct 9, 2023
@Deeds67
Copy link
Author

Deeds67 commented Oct 9, 2023

I managed to work around the issue by reverting to an older version: "next": "13.5.3". Bug appears in 13.5.4 and later.

@kdy1
Copy link
Member

kdy1 commented Oct 10, 2023

This is a regression between swc_core@v0.83.12 and swc_core@v0.83.28

next.js/Cargo.lock

Lines 6661 to 6663 in 76e06d5

[[package]]
name = "swc_core"
version = "0.83.12"

next.js/Cargo.lock

Lines 5811 to 5813 in 1e8dca4

[[package]]
name = "swc_core"
version = "0.83.28"


Range: swc-project/swc@e67bf05...83f77dd

@kdy1
Copy link
Member

kdy1 commented Oct 11, 2023

I think this can be a same issue as #56550
I'll investigate

@kdy1
Copy link
Member

kdy1 commented Oct 11, 2023

image

This is the same issue as exceljs issue linked at #56550 (comment)

@alexews
Copy link

alexews commented Oct 12, 2023

Hello,
I've faced same issue with Nextjs 13.5.4

@pmingkr
Copy link

pmingkr commented Oct 17, 2023

I've faced same issue with Nextjs 13.5.4.
I downgraded to 13.4.7 and built successfully.

  • 13.4.19 is also succeeded.

sokra added a commit that referenced this issue Oct 17, 2023
### What?

Update SWC crates, to apply bugfixes.

### Why?

We adjusted the mangling option to make it identical with `swcMinify:
false` with #56281, and it
revealed some bugs of the name mangler of the SWC minifier.

### How?


 - Fixes #56550
 - Fixes #56614

 - Turbopack counterpart: vercel/turborepo#6171

### Other Turbopack Changes

* vercel/turborepo#6177 <!-- Tim Neutkens - Add
support for FreeVarReference::Error -->
* vercel/turborepo#6180 <!-- Tobias Koppers - fix
chunk loading in build runtime -->
* vercel/turborepo#6191 <!-- Justin Ridgewell -
Deduplicate referenced_output_assets -->
* vercel/turborepo#6171 <!-- Donny/강동윤 - build:
Update `swc_core` to `v0.86.1` -->

Closes WEB-1775

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
@kelihansen
Copy link

I'm still experiencing this issue with v13.5.6-canary.2 of next 🤔

@kdy1
Copy link
Member

kdy1 commented Oct 18, 2023

@kelihansen If so, please file another issue. It's a different one.

@NPJigaK
Copy link

NPJigaK commented Oct 20, 2023

When using Material Tailwind, downgrading the next version to 13.5.3 solves the problem. 13.5.4 or higher will cause an error. v13.5.7-canary.9 as well.

@rjnls
Copy link

rjnls commented Oct 24, 2023

When using Material Tailwind, downgrading the next version to 13.5.3 solves the problem. 13.5.4 or higher will cause an error. v13.5.7-canary.9 as well.

Thank you @NPJigaK, my issue was not during build, instead it was the same error at runtime in the browser console. Downgrade to 13.5.3 solved it. I couldn't even use a component that consisted of nothing but <Card>Hi</Card> without this happening. All of this worked perfectly in local run dev and I could always build fine, never once in 4 hours of debugging did it fail to build (except for typos), only deployment revealed the issue and only during runtime. That had me dissecting the chunk arrays in the build output, aka hell.

@kdy1
Copy link
Member

kdy1 commented Oct 24, 2023

@NPJigaK Does it happen with v13.5.7-canary.16?

@kelihansen
Copy link

v13.5.7-canary.16 appears to fix the issue for me 🙌

@NPJigaK
Copy link

NPJigaK commented Oct 24, 2023

@kdy1 It was fixed in v13.5.7-canary.16! Thanks!

Copy link
Contributor

github-actions bot commented Nov 7, 2023

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.

@github-actions github-actions bot added the locked label Nov 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 2023
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. linear: turbopack Confirmed issue that is tracked by the Turbopack team. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants