Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
How to define SharedArrayBuffer in Chrome?

I am working on React + WASM + FFmpeg app following this tutorial

On Chrome, I got the error Uncaught (in promise) ReferenceError: SharedArrayBuffer is not defined error.

I followed the doc reference, and it says the below, which I don't understand.


Cross-origin isolation overview

You can make a page cross-origin isolated by serving the page with these headers:

Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin

What does serving the pages with these headers mean?

How do I implement that?

I even found Chrome dev's official video, but even that does not explain any implementation detail.

Edit2: The best instruction I can find is here, but even that is too vague for me. What does it mean by setting a header? I'm not requesting anything to begin with.

Edit: My React version is already 17.0.2, so this should have been fixed but I am somehow getting this error as well...

[Deprecation] SharedArrayBuffer will require cross-origin isolation as of M92, around July 2021.

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

Let's start off by saying what serving the pages with these headers means.

If you have ever built an API with Express.js for example, you'll be familiar with this. Essentially, it means that when the user makes a GET request to see the web page, you will have to send some additional information in the form of HTTP headers.

Specifically, the first header prevents your page from loading any cross-origin resources that don't explicitly grant permission. The second one means that you can't share a browsing context group with any cross-origin documents. Both of these are used as safety measures to prevent cross-origin attacks. Even though you may not be requesting anything, you have to apply them.

Now onto your problem, I would recommend installing the Chrome extension CORS. I don't know exactly how it works, but I have used it in the past and it will be a temporary solution. I skimmed through the tutorial you're following and I didn't see a server setup (as in Express.js/Node's http for instance). If you had any of these you could pass the headers as arguments to the servers.

To check if the CORS settings are working as intended, add the following code to your app:

if (crossOriginIsolated) {
    // Works
}
about 4 years ago · Juan Pablo Isaza Relatório

0

The SharedArrayBuffer serves the purpose of sharing data buffers between your main browsing context and another agent (another web page or a worker).

However, to minimize the possible security vulnerabilities, the specification states that this API can only be operated in a secure context.

In addition to this security prerequisite, it is also necessary for any top-level document to be in a Cross Origin Isolation. This means, the party serving the contents should tell the browser that it should block the loading of cross-origin resources. (A document from domain A trying to get data from Domain B)

This is done by the servers by specifying the following two response eaders when serving the website:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

How to specify them in your debug environment?

You need to set up a standard file server such as Apache. Then you will have to tweak its configuration to serve the above headers with the files.

Quick setup: https://www.wampserver.com/en/

An answer provisioning the header info: https://stackoverflow.com/a/35566100/4185234

about 4 years ago · Juan Pablo Isaza Relatório

0

I ran into this recently and found your question and the answers above

What does serving the pages with these headers mean?

It means configuring the server serving your pages to include those headers. How you configure a server depends on the software you're using, Apache, Nginx, Caddy, or if you're using one of the 1000s of others or writing your own.

I've written 2 (or more correctly, I've used a library to write 2) and I added the option to include those headers. Both are open source so you can look inside if you want to see how they work.

If you prefer a UI then there's this one. If you prefer the command line then install node.js and then you can use this one

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda