Skip to content

Cannot snapshot stories with videos (206 response code) #1133

Description

@jagregory

The problem

When snapshotting a Storybook story which includes a video element, if the static file server responds with a 206 (for a partial content response with a range request) then the asset is not downloaded and the snapshot fails.

[percy:core:discovery] Processing resource: http://localhost:52458/content/storybook/example.mp4 (1ms)
[percy:core:discovery] Request failed for http://localhost:52458/content/storybook/example.mp4: net::ERR_ABORTED (0ms)
[percy:core:discovery] - Skipping disallowed status [206] (0ms)

Initially, I thought it was just the 206 issue, and I manually edited this line:

const ALLOWED_STATUSES = [200, 201, 301, 302, 304, 307, 308];

But when I changed that line to include 206, the request appears to complete but the snapshot is still blank:

[percy:core:discovery] Handling request: http://localhost:8080/content/storybook/example.mp4 (20ms)
[percy:core:discovery] Processing resource: http://localhost:8080/content/storybook/example.mp4 (1ms)
[percy:core:discovery] - sha: 681b3d65176d6a4aa1a249f9a9fae0c91006ddcb125d9fd5f314900ca8936a7d (3ms)
[percy:core:discovery] - mimetype: video/mp4 (0ms)

(Note: the sha does match the sha of the full file on disk)

image

I've tried a few things that didn't have any effect:

  • Different static file servers (vite, npx http-server, and python's http.server)
  • Reduced concurrency down to 1
  • Set headless=false and tried requesting the resource directly in a new tab, video did not appear
  • Tested against a running Storybook instance vs a built bundle, neither work

Environment

  • Node version: v18.12.0
  • @percy/cli version: 1.14.0
  • Version of Percy SDK you’re using: 4.3.4
  • If needed, a build or snapshot ID: 22989497
  • OS version: OS X 12.6.1
  • Type of shell command-line [interface]: fish

I'm using @storybook/builder-vite (0.2.2) and vite (3.0.4) for the local dev server.

Details

Other assets are fine, but any video fails with the same issue regardless of size. My original video is 93mb, but I've tested with the smallest video I can (4kb) and it behaves the same.

Unfortunately, I'm on a poor quality internet connection at the moment so I can't test against remotely hosted assets.

Debug logs

Version from npm:

[percy:core:discovery] Processing resource: http://localhost:52458/content/storybook/example.mp4 (1ms)
[percy:core:discovery] Request failed for http://localhost:52458/content/storybook/example.mp4: net::ERR_ABORTED (0ms)
[percy:core:discovery] - Skipping disallowed status [206] (0ms)

Modified to allow 206 responses codes:

[percy:core:discovery] Handling request: http://localhost:8080/content/storybook/example.mp4 (20ms)
[percy:core:discovery] Processing resource: http://localhost:8080/content/storybook/example.mp4 (1ms)
[percy:core:discovery] - sha: 681b3d65176d6a4aa1a249f9a9fae0c91006ddcb125d9fd5f314900ca8936a7d (3ms)
[percy:core:discovery] - mimetype: video/mp4 (0ms)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions