question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React App Example Throws Error (SharedArrayBuffer is not defined)

See original GitHub issue

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Clone the repo
  2. Install dependencies (yarn)
  3. Run app (yarn start)
  4. Open http://localhost:300
  5. Click “Start”
  6. You will see an error like:
Unhandled Rejection (ReferenceError): SharedArrayBuffer is not defined
▶ 2 stack frames were collapsed.
async doTranscode
src/App.js:13
  10 | });
  11 | const doTranscode = async () => {
  12 |   setMessage('Loading ffmpeg-core.js');
> 13 |   await ffmpeg.load();
     | ^  14 |   setMessage('Start transcoding');
  15 |   ffmpeg.FS('writeFile', 'test.avi', await fetchFile('/flame.avi'));
  16 |   await ffmpeg.run('-i', 'test.avi', 'test.mp4');
View compiled
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.  Click the 'X' or hit ESC to dismiss this message.

Expected behavior Of course, the demo working fresh from an install to work.

Screenshots Screen Shot 2021-08-13 at 11 22 42 AM

Desktop (please complete the following information):

  • OS: macOS 11.4
  • Browser Chrome
  • Version 92.0.4515.131 (Official Build) (x86_64)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13

github_iconTop GitHub Comments

5reactions
dnskingcommented, Oct 28, 2021

--enable-features=SharedArrayBuffer is no longer supported, you have to add the meta tag <meta http-equiv="origin-trial" content="token"> to your index.html header. You can get your token from here

3reactions
Francois-Laberge-Bosecommented, Aug 13, 2021

Protip to future explorers. Here’s how you enable sharedbuffers when developing on localhost.

Enabling cross-origin isolation on a local server might be a pain as simple servers do not support sending headers. You can launch Chrome with a command line flag --enable-features=SharedArrayBuffer to enable SharedArrayBuffer without enabling cross-origin isolation. Learn: how to run Chrome with a command line flag on respective platforms.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: SharedArrayBuffer is not defined · Issue #3
Bow I am getting another error: Error: ffmpeg.wasm is not ready, make sure you have completed load(). Wonder if his has something to...
Read more >
React Error: "SharedArrayBuffer is not defined" in Firefox
I have a React app, created with ' ...
Read more >
React Error: "SharedArrayBuffer is not defined" in Firefox ...
Coding example for the question React Error: "SharedArrayBuffer is not defined" in Firefox-Reactjs.
Read more >
How to fix SharedArrayBuffer is not defined error - TechKBlog
Came across this "SharedArrayBuffer is not defined" error in Firefox browser, while working on a react app of mine. This is how I...
Read more >
SharedArrayBuffer - JavaScript - MDN Web Docs
With these two headers set, postMessage() no longer throws for SharedArrayBuffer objects and shared memory across threads is therefore ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found