You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refused to create a worker from blob: CSP error #372
Due to the content security policy in our app containing worker-src: self I get an error when react-scan loads due to the app refusing to create the worker like:
react-scan.ts:10 Refused to create a worker from 'blob:https://<redacted>' because it violates the following Content Security Policy directive: "worker-src 'self'".
I'd prefer not to add blob: here. However, react-scan still seems to function as I would expect. Is there some fallback for the worker that makes it unnecessary, or is it required for some functionality only? Thanks in advance
Added useOffscreenCanvasWorker option. Set it to false and React Scan won't attempt the blob worker at all, so your CSP doesn't see the violation. The fallback to main-thread rendering already worked, but this lets you skip the failed attempt entirely.
Stopped console.warn-ing on worker-creation failure unless _debug: 'verbose' is set, so even with the default config you no longer get the noisy CSP error per page load.
Activity
RobPruzan commentedon May 2, 2025
Yeah we have a fallback for usage without workers. We can add an option for scan({...}) to control this explicitly
aidenybai commentedon May 2, 2026
Fixed in v0.5.5 via #437.
Two changes:
useOffscreenCanvasWorkeroption. Set it tofalseand React Scan won't attempt the blob worker at all, so your CSP doesn't see the violation. The fallback to main-thread rendering already worked, but this lets you skip the failed attempt entirely.console.warn-ing on worker-creation failure unless_debug: 'verbose'is set, so even with the default config you no longer get the noisy CSP error per page load.