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

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

Closed
jaysonwu991 opened this issue Sep 10, 2024 · 15 comments
Closed
Labels
🧹 maintenance General maintenance

Comments

@jaysonwu991
Copy link

jaysonwu991 commented Sep 10, 2024

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)
@unlikelyzero
Copy link

Possibly the same #1716

@jaysonwu991
Copy link
Author

Possibly the same #1716

Error log is not the same, just updated.

@prklm10
Copy link
Contributor

prklm10 commented Sep 16, 2024

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

@prklm10
Copy link
Contributor

prklm10 commented Sep 18, 2024

@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
Copy link
Contributor

prklm10 commented Sep 18, 2024

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

@jaysonwu991
Copy link
Author

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
Copy link
Author

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} />;

@prklm10 prklm10 added the 🧹 maintenance General maintenance label Sep 27, 2024
@ninadbstack
Copy link
Contributor

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.

@jaysonwu991
Copy link
Author

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

@ninadbstack
Copy link
Contributor

@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"

@jaysonwu991
Copy link
Author

@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?

Copy link

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 github-actions bot added the 🍞 stale Closed due to inactivity label Oct 29, 2024
@oscard0m
Copy link

oscard0m commented Nov 8, 2024

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/@percy+storybook@6.0.2_typescript@5.6.3/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/@percy+storybook@6.0.2_typescript@5.6.3/node_modules/@percy/storybook/dist/snapshots.js:198:9)
    at async Object.callback (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@percy+storybook@6.0.2_typescript@5.6.3/node_modules/@percy/storybook/dist/storybook.js:36:3)
    at async generatePromise (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@percy+core@1.30.1_typescript@5.6.3/node_modules/@percy/core/dist/utils.js:165:115)
    at async runCommandWithContext (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@percy+cli-command@1.30.1_typescript@5.6.3/node_modules/@percy/cli-command/dist/command.js:136:3)
    at async percy (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@percy+cli-command@1.30.1_typescript@5.6.3/node_modules/@percy/cli-command/dist/command.js:166:9)
    at async /home/runner/work/gravity/gravity/node_modules/.pnpm/@percy+cli@1.30.1_typescript@5.6.3/node_modules/@percy/cli/bin/run.cjs:14:5 (1ms)
/home/runner/work/gravity/gravity/packages/dashboard:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @gravityci/dashboard@0.0.1 percy: `percy storybook ./storybook-static --verbose`

@jaysonwu991
Copy link
Author

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/@percy+storybook@6.0.2_typescript@5.6.3/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/@percy+storybook@6.0.2_typescript@5.6.3/node_modules/@percy/storybook/dist/snapshots.js:198:9)
    at async Object.callback (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@percy+storybook@6.0.2_typescript@5.6.3/node_modules/@percy/storybook/dist/storybook.js:36:3)
    at async generatePromise (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@percy+core@1.30.1_typescript@5.6.3/node_modules/@percy/core/dist/utils.js:165:115)
    at async runCommandWithContext (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@percy+cli-command@1.30.1_typescript@5.6.3/node_modules/@percy/cli-command/dist/command.js:136:3)
    at async percy (file:///home/runner/work/gravity/gravity/node_modules/.pnpm/@percy+cli-command@1.30.1_typescript@5.6.3/node_modules/@percy/cli-command/dist/command.js:166:9)
    at async /home/runner/work/gravity/gravity/node_modules/.pnpm/@percy+cli@1.30.1_typescript@5.6.3/node_modules/@percy/cli/bin/run.cjs:14:5 (1ms)
/home/runner/work/gravity/gravity/packages/dashboard:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @gravityci/dashboard@0.0.1 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.

@github-actions github-actions bot removed the 🍞 stale Closed due to inactivity label Nov 12, 2024
@prklm10
Copy link
Contributor

prklm10 commented Dec 2, 2024

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

@prklm10 prklm10 closed this as completed Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 maintenance General maintenance
Projects
None yet
Development

No branches or pull requests

5 participants