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

fix(core): use concat in buildAllWorkspaceFiles to avoid Maximum call stack size exceeded #18065

Merged
merged 2 commits into from
Jul 12, 2023

Conversation

chentsulin
Copy link
Contributor

Use .concat instead of .push(...arr) to avoid Maximum call stack size exceeded.

Current Behavior

Got this error in an large monorepo:

/home/********/project/node_modules/.pnpm/[email protected]/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:68
    fileData.push(...globalFiles);
             ^

RangeError: Maximum call stack size exceeded
    at buildAllWorkspaceFiles (/home/********/project/node_modules/.pnpm/[email protected]/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:68:14)
    at /home/********/project/node_modules/.pnpm/[email protected]/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:43:32
    at Generator.next (<anonymous>)
    at fulfilled (/home/********/project/node_modules/.pnpm/[email protected]/node_modules/tslib/tslib.js:166:62)

Expected Behavior

Do not throw RangeError: Maximum call stack size exceeded

Related Issue(s)

Fixes #

@chentsulin chentsulin requested a review from a team as a code owner July 11, 2023 09:21
@chentsulin chentsulin requested a review from Cammisuli July 11, 2023 09:21
@vercel
Copy link

vercel bot commented Jul 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2023 5:17pm

@nx-cloud
Copy link

nx-cloud bot commented Jul 11, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit b44823c. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@Cammisuli
Copy link
Member

Thanks for the PR! I seen someone complain about this before, but they didn't give me much info, and the problem was fixed for them when they used a different version of Node.

Is the Nx workspace that gave you this error open source or available for me to use as a benchmark?

@chentsulin
Copy link
Contributor Author

@Cammisuli It's a private repo, so I can't share with you. Sorry for that.

@Cammisuli
Copy link
Member

@chentsulin can I get some details on the workspace? How many projects do you have, and how many global files were there as well?

@Cammisuli Cammisuli merged commit c364207 into nrwl:master Jul 12, 2023
@chentsulin
Copy link
Contributor Author

@Cammisuli AFAICT, we have more than 100 packages and 30 Next.js websites.

@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants