Forum Discussion
Load React component inside power BI - Failed to construct 'Worker'
- 7 months ago
Hi,
This behavior is expected due to the Power BI custom visual sandboxing model. Custom visuals run inside a sandboxed iframe with an opaque origin (origin = 'null'). Because of that, creating a Web Worker from a URL like https://app.powerbi.com/.../worker.js fails the browser’s origin checks, which is why you see:
Failed to construct 'Worker' ... cannot be accessed from origin 'null'
So to your question: loading a separate worker.js file by URL is effectively restricted in Power BI Service and isn’t something the visual can override.
Workable alternatives are:
Bundle the worker and create it via a Blob URL (or bundler-supported worker import), instead of loading worker.js as a hosted script.
If the worker is mainly for heavy compute, consider moving the processing outside the visual (backend/Fabric) or running the WASM on the main thread if feasible.
In short: Power BI is unlikely to allow externally loaded worker scripts, so the practical solution is to inline/bundle the worker rather than fetch it as a separate file.
Hi,
This behavior is expected due to the Power BI custom visual sandboxing model. Custom visuals run inside a sandboxed iframe with an opaque origin (origin = 'null'). Because of that, creating a Web Worker from a URL like https://app.powerbi.com/.../worker.js fails the browser’s origin checks, which is why you see:
Failed to construct 'Worker' ... cannot be accessed from origin 'null'
So to your question: loading a separate worker.js file by URL is effectively restricted in Power BI Service and isn’t something the visual can override.
Workable alternatives are:
Bundle the worker and create it via a Blob URL (or bundler-supported worker import), instead of loading worker.js as a hosted script.
If the worker is mainly for heavy compute, consider moving the processing outside the visual (backend/Fabric) or running the WASM on the main thread if feasible.
In short: Power BI is unlikely to allow externally loaded worker scripts, so the practical solution is to inline/bundle the worker rather than fetch it as a separate file.
Thanks for the solution, It resolved the worker.js error on using BLOB.
blob:null/ Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': Failed to parse URL from mMapSDK.worker.wasm at instantiateAsync at createWasm.
mohit_sakhare , Any possible fixes to resolve this?