percy / cli

The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
https://docs.percy.io/docs/cli-overview
70 stars 43 forks source link

RangeError: Maximum call stack size exceeded #735

Closed dmitry12 closed 2 years ago

dmitry12 commented 2 years ago

The problem

After upgrading from @percy/storybook": "^3.3.1 to "@percy/cli": "^1.0.0-beta.73", "@percy/storybook": "^4.1.0" and running it on github hosted runner I encountered this error:

RangeError: Maximum call stack size exceeded
Exception in PromiseRejectCallback:
/home/runner/work/app/app/storybook/node_modules/@percy/core/dist/utils.js:162
      return yield* check(start);
             ^

Environment

Details

Debug logs

Debug output: https://gist.github.com/dmitry12/fc9d07665b3171dd372857fc9d6bed8e

Code to reproduce issue

I created repo with 300 sample stories and was able to reproduce the error: https://github.com/dmitry12/percy-bug-repro

npm/yarn install
percy storybook --debug ./storybook-static
wwilsman commented 2 years ago

Thanks for the detailed reproduction, @dmitry12!

Looks like there is a recursive tail call that should be further optimized. The place it's bubbling from sometimes runs for a lengthy amount of time (especially on large builds). So likely the call stack is continuously growing until it's too large.

You might be able to pin to @percy/cli@1.0.0-beta.71 for now, but I'll work on getting a fix for this out asap. 🤞

cancan101 commented 2 years ago

I am also having this error. I was previously on 1.0.0-beta.69 which did not raise the error but does seem to hang indefinitely on:

[percy:client] Uploading resource: /percy.1629232245XXX.log... (2ms)
[percy:client] Finalizing snapshot XXX784804... (323ms)
[percy:client] Finalizing snapshot XXX784803... (2ms)

We are not using Storybook, just a handful of pre-compiled next.js pages.

UPDATE: It actually fine with 69, it was with a different change that I started seeing the hanging on 69 which is why I had tried to upgrade to 73.

filipw01 commented 2 years ago

@wwilsman I tried pinning @percy/cli@1.0.0-beta.71 and it was producing the same error

cancan101 commented 2 years ago

@percy/cli@1.0.0-beta.71 works for me but then when I made other changes I am still seeing it hanging on the Finalizing step.

wwilsman commented 2 years ago

I just released v1.0.0-beta.74 which should hopefully fix the call stack error. 🤞

@cancan101 if updating doesn't help your hanging issue, maybe it's worth opening another discussion for that

cancan101 commented 2 years ago

ok, I can confirm that v1.0.0-beta.74 did fix the call stack issue. I have reported #742 with the hanging issue which still exists in the new version.

rmknecht commented 2 years ago

I am encountering the same call stack error. Bumping to v1.0.0-beta.74 did not resolve the issue.

Using "@percy/storybook": "^4.1.0" and generating 400+ snapshots

wwilsman commented 2 years ago

@rmknecht could you share your error message?

From the original issue, return yield* check(start); doesn't exist anymore. So if you're still receiving a stack trace error, it's possible the stack is growing in a different location for a similar reason

rmknecht commented 2 years ago

@wwilsman - It looks like my issue was the result of a stale version of @percy/cli in the project's monorepo. After wiping node_modules directories and reinstalling with v1.0.0-beta.74 I am no longer encountering the stack error. All set here 👍

filipw01 commented 2 years ago

Seems to be working for me. Lots of thanks @wwilsman 🙏

wwilsman commented 2 years ago

That's great! Closing this now. 😄

dmitry12 commented 2 years ago

@wwilsman still encountering the same issue after upgrading to v1.0.0-beta.74 in example repo.

Package versions: @percy/cli: 1.0.0-beta.74 @percy/storybook: 4.1.0

Full debug log: https://gist.github.com/dmitry12/92f9703c7a0deb929bdc621378c4d737

Robdel12 commented 2 years ago

Hey @dmitry12! I think you're having a caching issue (https://github.com/percy/cli/issues/735#issuecomment-1020618853)

/Users/dmitry/dev/repos/percy-bug-repro/node_modules/@percy/storybook/node_modules/@percy/core/dist/utils.js:162
      return yield* check(start);

Is the same stack trace as the original issue and that code no longer exists. This is the new util dist output:

image