question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

graceful-fs crashes with "RangeError: Maximum call stack size exceeded"

See original GitHub issue

❗️ 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 exceeded while 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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:66
  • Comments:37 (13 by maintainers)

github_iconTop GitHub Comments

22reactions
dashmugcommented, Sep 11, 2019

Same problem here. graceful-fs not being graceful.

17reactions
calebswank11commented, Sep 11, 2019

@vitorfs it’s most likely caused by fact that at /codebuild/output/src942665664/src/node_modules/graceful-fs there’s non latest (and buggy) graceful-fs version installed.

Ensure to update dependencies of the project and issue should be fixed

~ 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.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Random crashes with "Maximum call stack size exceeded"
Go to the node-red folder and try the command npm ls graceful-fs This should show you a dependency tree. When you find out...
Read more >
Why is my Kotlin/JS program failing with "RangeError
I've written a Kotlin/JS program that is crashing on some JavaScript engines. It's crashing on GraalVM like this: RangeError: Maximum call stack ......
Read more >
Node-Red Crashed [Error] [Function:Status] Rangeerror
When looping with function nodes if the input is large 600+ size array function node will throw RangeError: Maximum call stack size exceeded...
Read more >
Sls deploy - RangeError: Maximum call stack size exceeded
Deploying with latest release (1.52) - today's error is: RangeError: Maximum call stack size exceeded at Function.[Symbol.
Read more >
How to fix: "RangeError: Maximum call stack size exceeded"
This can lead to the program crashing or behaving in unexpected ways. It is important to avoid creating infinite loops or deeply nested ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found