Forum Discussion

keerthanabasa's avatar
keerthanabasa
Regular Visitor
7 months ago
Solved

Load React component inside power BI - Failed to construct 'Worker'

I'm working on rendering a react component inside power bi visual using bundle approach: Here is how we are rendering the component(index.tsx): import * as React from "react"; import { createRoot...
  • mohit_sakhare's avatar
    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.