Fix 'SharedArrayBuffer is not defined': a practical guide to cross-origin isolation (opens in new tab)
If you've ever seen this in the console: Uncaught ReferenceError: SharedArrayBuffer is not defined or your multithreaded WebAssembly quietly fell back to a single thread, the cause is almost always the same thing: your page is not cross-origin isolated. Here's what that means, why the browser does it, and exactly how to fix it. TL;DR Send these two headers on the response for the document that loads your code: Cross-Origin-Opener-Policy: same-origin Cross-Origin-Embedder-Policy: require-corp ...
Read the original article