cli icon indicating copy to clipboard operation
cli copied to clipboard

Percy CLI takes snapshots successfully but throws an error in the end

Open jaysonwu991 opened this issue 1 year ago • 7 comments

Description

Percy CLI takes snapshots successfully but still throws an error in the end, this makes the whole job failed on CI, the link from Finalized build #2821 actually can be open successfully.

Environment

node: 18.20.4 npm: 10.7.0 storybook: 8.2.9 @percy/cli: 1.29.3 @percy/storybook: 6.0.2

Command

percy storybook -d dist-storybook

Issue Log ID

36300846_build_36300846_cli_b977465ae0d39e39d9e48dffbd5978bae35dfc70

Issue Snapshot

image

Local Error Log

[percy:core] Build not created (0ms)
[percy:core] Detected error for percy build (2ms)
[percy:core] Failure: Snapshot command was not called (0ms)
[percy:core] Failure Reason: Snapshot Command was not called. please check your CI for errors (0ms)
[percy:core] Suggestion: Try using percy snapshot command to take snapshots (0ms)
[percy:core] Refer to the below Doc Links for the same (0ms)
[percy:core] * https://www.browserstack.com/docs/percy/take-percy-snapshots/ (0ms)
[percy:client] Sending Build Logs (126ms)
[percy:env] Detected ci as null (0ms)
[percy:env] Detected info as null (0ms)
[percy:core] Build's CLI and CI logs sent successfully. Please share this log ID with Percy team in case of any issues - cli_9d354772dc9d60d227732dc3e7ffe6d8eda5f4e3 (1673ms)

jaysonwu991 avatar Sep 10 '24 08:09 jaysonwu991

Possibly the same https://github.com/percy/cli/issues/1716

unlikelyzero avatar Sep 10 '24 13:09 unlikelyzero

Possibly the same #1716

Error log is not the same, just updated.

jaysonwu991 avatar Sep 11 '24 03:09 jaysonwu991

@jaysonwu991 thanks for raising the issue we will check it out.

prklm10 avatar Sep 16 '24 13:09 prklm10

@jaysonwu991 the error was thrown due to the error when running the storybook command. It is not the percy error. You can ignore this error by setting this env variable PERCY_EXIT_WITH_ZERO_ON_ERROR to true.

prklm10 avatar Sep 18 '24 05:09 prklm10

Also @jaysonwu991 we don't know why storybook is throwing error. So can you please provide a reproducible example.

prklm10 avatar Sep 18 '24 13:09 prklm10

Also @jaysonwu991 we don't know why storybook is throwing error. So can you please provide a reproducible example.

Will try to provide the example sooner, Thanks for tracking this issue.

jaysonwu991 avatar Sep 18 '24 13:09 jaysonwu991

Got new error:

[percy:client] Finalizing build 36543095... (0ms)
[percy:core] Finalized build #2938: https://percy.io/1c744400/falcon/builds/36543095 (343ms)
[percy:client] Sending Build Logs (219ms)
[percy:core] Build's CLI and CI logs sent successfully. Please share this log ID with Percy team in case of any issues - 36543095_build_36543095_cli_dbe5a8ed09d6df41a99b7fd4912c102a2f57886d (824ms)
[percy:cli] Error: Object
    at withPage (file:///Users/jaysonwu/Projects/falcon/client/node_modules/@percy/storybook/dist/utils.js:156:51)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async takeStorybookSnapshots (file:///Users/jaysonwu/Projects/falcon/client/node_modules/@percy/storybook/dist/snapshots.js:198:9)
    at async Object.callback (file:///Users/jaysonwu/Projects/falcon/client/node_modules/@percy/storybook/dist/storybook.js:36:3)
    at async generatePromise (file:///Users/jaysonwu/Projects/falcon/client/node_modules/@percy/core/dist/utils.js:164:115)
    at async runCommandWithContext (file:///Users/jaysonwu/Projects/falcon/client/node_modules/@percy/cli-command/dist/command.js:136:3)
    at async percy (file:///Users/jaysonwu/Projects/falcon/client/node_modules/@percy/cli-command/dist/command.js:166:9)
    at async /Users/jaysonwu/Projects/falcon/client/node_modules/@percy/cli/bin/run.cjs:14:5 (5ms)
image

And is there anything wrong with AboutAirline Storybook file?

import { DesktopPageWidthWrapper } from '../story-helpers/Wrapper';

import AboutAirline from './AboutAirline';

import type { Meta } from '@storybook/react';

const props = {
  headerH2: 'Airline Header Here',
  aboutAirlineBlurb: 'Airline blurb here',
  panels: [
    {
      header: 'Section Header',
      image: 'image.jpg',
      text: 'Section text goes here, to be shown when the user expands the section',
    },
  ],
};
const propsWithImage = {
  ...props,
  airlineLogo:
    'https://content.skyscnr.com/afe9d4d28adc8055032b920b181a1504/ai-template-emirates-full-1.svg',
};

const meta: Meta<typeof AboutAirline> = {
  title: 'AboutAirline',
  component: AboutAirline,
  decorators: [
    (Story) => <DesktopPageWidthWrapper>{Story()}</DesktopPageWidthWrapper>,
  ],
};

export default meta;

export const WithoutImage = () => <AboutAirline {...props} />;
export const WithImage = () => <AboutAirline {...propsWithImage} />;

jaysonwu991 avatar Sep 24 '24 10:09 jaysonwu991

Its probably not related to storybook file. Let me have a look but from glance it looks like something is breaking in the chromium CDP connection.

ninadbstack avatar Oct 07 '24 10:10 ninadbstack

Finally fix this issue:

  • Code inside .stories.tsx but it is missing a module import - Related to our Eslint static checking
  • JS/TS rules checking is removed during Storybook build (dist-storybook) and build is still successfully - Related to our bundler
  • Run Percy CLI without checking any Storybook build, then it throws this error in the end - Any chance for Percy CLI to check Storybook build and throw the correct logs if any related?
image

jaysonwu991 avatar Oct 10 '24 06:10 jaysonwu991

@jaysonwu991 can you create a small reproducible example for this ? where its clearly marked that commenting some import would cause percy to throw exception. So that we can reproduce this on our side. Further for Any chance for Percy CLI to check Storybook build and throw the correct logs if any related? any command you are aware of that would help us validate storybook build ? if not then we will investigate but would likely lead to we reporting some generic error around "something failed while loading the story"

ninadbstack avatar Oct 11 '24 08:10 ninadbstack

@jaysonwu991 can you create a small reproducible example for this ? where its clearly marked that commenting some import would cause percy to throw exception. So that we can reproduce this on our side. Further for Any chance for Percy CLI to check Storybook build and throw the correct logs if any related? any command you are aware of that would help us validate storybook build ? if not then we will investigate but would likely lead to we reporting some generic error around "something failed while loading the story"

@ninadbstack I am not sure why our TS type check && Eslint static check were not working correctly, but it did pass the TS type check && Eslint static check, and there were no errors from both Webpack build and Storybook build (We didn't customize the Webpack configuration for Storybook, that is why it shows info => Removing existing JavaScript and TypeScript rules.), so it is hard to provide a small reproducible example for this, really sorry for this. I think we can close this issue now, WDYT?

jaysonwu991 avatar Oct 11 '24 08:10 jaysonwu991

This issue is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Oct 29 '24 19:10 github-actions[bot]

It's happening to me, same error stack:

[percy:client] Sending Build Logs (348ms)
[percy:timer] client:post - build.send_logs - 0.314s (314ms)
[percy:core] Build's CLI and CI logs sent successfully. Please share this log ID with Percy team in case of any issues - 37282916_build_37282916_cli_dd9615c7b655db7fe6bb2315328761a0c1876a08 (0ms)
[percy:cli] Error: Object
    at withPage (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/storybook/dist/utils.js:156:51)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async takeStorybookSnapshots (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/storybook/dist/snapshots.js:198:9)
    at async Object.callback (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/storybook/dist/storybook.js:36:3)
    at async generatePromise (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/core/dist/utils.js:165:115)
    at async runCommandWithContext (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/cli-command/dist/command.js:136:3)
    at async percy (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/cli-command/dist/command.js:166:9)
    at async /home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/cli/bin/run.cjs:14:5 (1ms)
/home/runner/work/gravity/gravity/packages/dashboard:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @gravityci/[email protected] percy: `percy storybook ./storybook-static --verbose`

oscard0m avatar Nov 08 '24 15:11 oscard0m

It's happening to me, same error stack:

[percy:client] Sending Build Logs (348ms)
[percy:timer] client:post - build.send_logs - 0.314s (314ms)
[percy:core] Build's CLI and CI logs sent successfully. Please share this log ID with Percy team in case of any issues - 37282916_build_37282916_cli_dd9615c7b655db7fe6bb2315328761a0c1876a08 (0ms)
[percy:cli] Error: Object
    at withPage (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/storybook/dist/utils.js:156:51)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async takeStorybookSnapshots (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/storybook/dist/snapshots.js:198:9)
    at async Object.callback (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/storybook/dist/storybook.js:36:3)
    at async generatePromise (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/core/dist/utils.js:165:115)
    at async runCommandWithContext (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/cli-command/dist/command.js:136:3)
    at async percy (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/cli-command/dist/command.js:166:9)
    at async /home/runner/work/gravity/gravity/node_modules/.pnpm/@[email protected][email protected]/node_modules/@percy/cli/bin/run.cjs:14:5 (1ms)
/home/runner/work/gravity/gravity/packages/dashboard:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @gravityci/[email protected] percy: `percy storybook ./storybook-static --verbose`

Hi @oscard0m For my cases, I checked all the stories in Storybook Review page, if there is something wrong with stories, it can't open normally and the definition of these stories might be wrong which needs your fixing or refactoring.

jaysonwu991 avatar Nov 12 '24 01:11 jaysonwu991

Closing this issue. Please re-open if it happens again

prklm10 avatar Dec 02 '24 06:12 prklm10