serverless: graceful-fs crashes with "RangeError: Maximum call stack size exceeded"
❗️ NOTE FROM MAINTAINERS ❗️
This issue is result of relying on non-latest (buggy) graceful-fs version, either directly or through other (not serverless) dependencies. serverless on its own expects latest version of graceful-fs to be installed.
Crash happens when two versions of graceful-fs are initialized and one of them is non-latest (buggy) version.
SOLUTION
Ensure project and its dependencies work only with latest graceful-fs version.
It usually can be solved by nuking node_modules and package-lock.json (or yarn.lock) and reinstalling the project.
When relying on Yarn package manager it can also be solved by adding following instruction to package.json
"resolutions": {
"graceful-fs": "4.2.2"
}
and running yarn install (thanks @sheerun for this tip)
This is a Bug Report
Description
- What went wrong?
RangeError: Maximum call stack size exceededwhile deploying - What did you expect should have happened? Deploy without problem
- What stacktrace or error message from your provider did you see?
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:199:24)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
at WriteStream (/opt/atlassian/pipelines/agent/build/node_modules/graceful-fs/graceful-fs.js:201:29)
Similar or dependent issues:
- #6653 is probably the origin of the problem
Additional Data
- Serverless Framework Version you’re using: 1.52.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 66
- Comments: 37 (13 by maintainers)
Commits related to this issue
- fix(renovate-config): pin serverless version See: https://github.com/serverless/serverless/issues/6667 — committed to balmbees/node-standard by mooyoul 5 years ago
- bug https://github.com/serverless/serverless/issues/6667 — committed to CuistotduCoin/front by romainquellec 5 years ago
- rollback serverless to 1.51.0 for now https://github.com/serverless/serverless/issues/6667 — committed to giffon/giffon by andyli 5 years ago
- Lock graceful-fs at 4.2.1 Fixes #6667 — committed to serverless/serverless by medikoo 5 years ago
- Lock graceful-fs at 4.2.1 Fixes #6667 — committed to serverless/serverless by medikoo 5 years ago
- chore: Upgrade `graceful-fs` to ^4.2.3 We were fixed on v4.2.1 due to critical bug in v4.2.2 (more info at #6667) but that's fixed with v4.2.3 — committed to serverless/serverless by medikoo 4 years ago
- chore: Upgrade `graceful-fs` to ^4.2.3 We were fixed on v4.2.1 due to critical bug in v4.2.2 (more info at #6667) but that's fixed with v4.2.3 — committed to serverless/serverless by medikoo 4 years ago
- chore: Upgrade `graceful-fs` to ^4.2.3 We were fixed on v4.2.1 due to critical bug in v4.2.2 (more info at #6667) but that's fixed with v4.2.3 — committed to richarddd/serverless by medikoo 4 years ago
- chore: Upgrade `graceful-fs` to ^4.2.3 We were fixed on v4.2.1 due to critical bug in v4.2.2 (more info at #6667) but that's fixed with v4.2.3 — committed to serverless/serverless by medikoo 4 years ago
Same problem here.
graceful-fsnot being graceful.~ Hat tip to ya good sir on pointing us in the right direction.
We ran into this issue on a pipeline build and got us head scratching for a bit. If doing this via ADO or Gitlab, ensure that you change the global serverless install during the build.
install -g serverless@1.51.0From our side, we faced the same issue 30 min ago. If i can add some info to it, our packages such as serverless-bundle, etc, are using an outdated version of graceful-fs. Adding a direct dependency to the same Graceful-fs dependency version Serverless has:
"graceful-fs": "^4.2.2",It should work for the time being, i know there may be prettier ways to fix it.Nothing like testing in production. Jeez.
Just a quick update that the v1.52.2 release will provide a fix for this issue --> https://github.com/serverless/serverless/pull/6718
Also seeing this problem. Rolling back to 1.51.0 solved it for me.
To fix this issue downgrade serverless to previous version by running npm i -g serverless@1.51.0
Workaround is to add to package.json:
and run
yarn installAt first I did roll back to version
1.51.0and it fixed the problem for me.Then I followed @medikoo tip, about
graceful-fsbeing outdated, and solved it by doing something else. I didn’t havegraceful-fsas a primary dependency, but several other packages depended on it, using different versions.I updated some packages and re-generated my
package-lock.jsonand it solved my issue. Now I’m successfully using1.52.0.Was about to create a new issue when I realised that this could potentially be the place where I also report it.
I was on the latest version of
serverless@1.52.0and runningserverless createthrew the same issue.Let me know if this should be in another issue.
My solution was to downgrade to
1.51.0We ran into this issue this morning and added the following to our package.json to resolve the issue for now (npm based):
@motoko89 I nuked my package.lock and node_modules folder and that worked for us.
I’ve updated main description with specific info on how this issue can be solved within a project
I had the exact same issue. You’ll need to roll back to a previous
serverlessversion or you’ll need to make suregraceful-fsis updated to its latest version by updating packages that depend on it (my case werefs-extraandnycbesidesserverless). I went for the latter.I started facing the same issue inside a CodeBuild a couple of hours ago. If I roll back to version
1.51.0it works normally.@hrnn Presented log is unrelated to this issue
~It is happening to me as well full logs~
Solved by updating
package-lock.jsonas other mentioned here.@vitorfs it’s most likely caused by fact that at
/codebuild/output/src942665664/src/node_modules/graceful-fsthere’s non latest (and buggy)graceful-fsversion installed.Ensure to update dependencies of the project and issue should be fixed