I have a small react app with a node.js backend (monorepo). The client is using @ffmpeg/ffmpeg, and all works fine locally, but when deployed to Heroku I'm getting the error ReferenceError: SharedArrayBuffer is not defined
. This happens when I run ffmpeg.load()
. Note that I am only using ffmpeg on the client in the React app.
What I have done so far:
setupProxy.js
in app.use
(located in the client directory). See this answer for contextresponse.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
response.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
crossOriginIsolated
, and verifying that it is true
locally but false
on my deployed site.It seems like something is wrong with my Cross-Origin config, or maybe it's just not being applied. Any help would be appreciated.
This was a silly mistake on my part. The Cross-Origin-* headers mentioned in the question were correct, they just had to be in index.js on the backend, not the client.