percy / percy-storybook

Percy's Storybook SDK.
https://docs.percy.io/docs/storybook
MIT License
150 stars 45 forks source link

Cannot run snapshots since moving to Vite #714

Closed Spence1115 closed 1 year ago

Spence1115 commented 1 year ago

Been using Percy for Storybook for a while now, working fine, but recently we've been moving from Webpack to Vite, and now it does not run.

The problem

When running percy storybook ./storybook-static --verbose since moving to Vite:

[percy:core:page] Page created (2ms)
[percy:core:page] Navigate to: http://localhost:34667/iframe.html (25ms)
[percy:core:page] Page navigated (206ms)
[percy:core:page] Page closed (18ms)
[percy:core] Stopping percy... (1ms)
[percy:core:browser] Closing browser (0ms)
[percy:core:browser] Browser closed (33ms)
[percy:core] Build not created (0ms)
[percy:cli] TypeError: Cannot read properties of undefined (reading 'message')
    at withPage (file:///home/circleci/project/node_modules/@percy/storybook/dist/utils.js:108:33)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async takeStorybookSnapshots (file:///home/circleci/project/node_modules/@percy/storybook/dist/snapshots.js:187:5)
    at async Object.callback (file:///home/circleci/project/node_modules/@percy/storybook/dist/storybook.js:36:3)
    at async generatePromise (file:///home/circleci/project/node_modules/@percy/core/dist/utils.js:85:115)
    at async runCommandWithContext (file:///home/circleci/project/node_modules/@percy/cli-command/dist/command.js:132:3)
    at async percy (file:///home/circleci/project/node_modules/@percy/cli-command/dist/command.js:162:9)
    at async /home/circleci/project/node_modules/@percy/cli/bin/run.cjs:13:5 

If I do a dry run percy storybook ./storybook-static --verbose --dry-run Everything works as expected

[percy:core] Snapshot found: Example/Inputs/SingleText: Suffix (0ms)
[percy:core:page] Page closed (2ms)
[percy:core] Found 5 snapshots (0ms)
[percy:core:browser] Closing browser (0ms)
[percy:core:browser] Browser closed (29ms)
[percy:core] Build not created (1ms)

Environment

Debug logs

Running with --debug gets me the same error as above

itsjwala commented 1 year ago

@Spence1115 could you provide a repro sample for us to debug? also, which version of Percy storybook SDK are you using?

stephiescastle commented 1 year ago

I had the exact same issue, and setting storyStoreV7 to false has fixed it. We're using that as a workaround, as it's not ideal.

itsjwala commented 1 year ago

could be related to #715, closing this one in favor of that, please reopen/notify us if that's not the case.