"SharedArrayBuffer is not supported!" , after 1-2 refreshes it disappears

I’m using this check at initialization:

if (!(typeof SharedArrayBuffer === 'function')) { fail() }

this usually works, except when I open a fresh browser, then it fails the first time I open my app. After one or two refreshes, the SharedArrayBuffer is detected. I have this in Edge, Chrome & Firefox. Do I need to “wait” for the SharedArrayBuffer to be detected, what’s the correct approach?

Hey @fides-it

Thanks for your feedback.

Using typeof SharedArrayBuffer === 'function' to check if SharedArrayBuffer is supported is correct.

Have you used service worker on your page or made configurations on the web server that may cause the response headers to vary with each page visit?

Thanks
Vic

Hi Vic, I’ve disabled my service worker in my Angular application for local development. I checked the Chrome devtools, there’s no service worker registered

edit: I got it figured out: I’m using a local proxy config (proxy.conf.js) in my Angular app that sets the COEP response headers, but the path for that was “/**”. The initial page I requested was “/” which didn’t match against the pattern… my bad!

edit: just posting this for my fellow Angular devs: the index.html is served as 304 - not modified b ythe build-angular:dev-server, but the COEP response headers are not set because it bypasses the proxy conf I set up… I’m looking for a solution still, or I might ignore it (on acc/prd there’s no caching of index.html)