ffmpegcypresssharedarraybuffer

SharedArrayBuffer not defined when using Cypress


I'm using Vite and Cypress for dev and testing

I'm loading ffmpeg, it loads fine on Chrome but on Cypress, it gives this error

ReferenceError: SharedArrayBuffer is not defined

Apparently, it's caused by cross origin isolation.

I tried disabling web security in Cypress.json but it didn't help

Sample code

import { createFFmpeg } from "@ffmpeg/ffmpeg"

const ffmpeg = createFFmpeg({ log: true })
ffmpeg.load()

Is there a workaround?

Minimal Repro https://github.com/unlocomqx/cypress-ffmpeg


Solution

  • I got a kind of the same problem in my project and I could reproduce your error with your example.

    Try to switch back your Cypress Version to 8.5.0 and run the tests with the Electron Browser. That's my workaround so far...

    From Cypress 8.5.0 to 8.6.0 they updated the Electron Version from 13.2.0 to 14.1.0: https://docs.cypress.io/guides/references/changelog#8-6-0

    I'll make a post and ask for help in the Cypress forum and link this post.

    Link to the Cypress Issue: https://github.com/cypress-io/cypress/issues/19912

    Thx for the example repo.