Skip to content

WebAssembly.instantiate() Blocked Due to CSP in Angular Application #104

Open
@rachidoubahmane99

Description

@rachidoubahmane99

Description

We are encountering a RuntimeError: abort(CompileError: WebAssembly.instantiate(): Refused to compile or instantiate WebAssembly module... when using the Twilio Video Processors library in an Angular 13 application. The error suggests that the WebAssembly module is being blocked due to Content Security Policy (CSP) restrictions, specifically the absence of 'unsafe-eval' in the script-src directive.

Error Details

have this error ; this error : main.1c883b45f74f198b.js:3 ERROR Error: Uncaught (in promise): RuntimeError: abort(CompileError: WebAssembly.instantiate(): Refused to compile or instantiate WebAssembly module because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' ....

Build with -s ASSERTIONS=1 for more info.
RuntimeError: abort(CompileError: WebAssembly.instantiate(): Refused to compile or instantiate WebAssembly module because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'

Build with -s ASSERTIONS=1 for more info.
at abort (tflite-1-0-0.js:9:7695)
at tflite-1-0-0.js:9:9736
at abort (tflite-1-0-0.js:9:7695)
at tflite-1-0-0.js:9:9736
at Rt (polyfills.0210c03de943e1e6.js:1:17069)
at polyfills.0210c03de943e1e6.js:1:16125
at polyfills.0210c03de943e1e6.js:1:16233
at xt (main.1c883b45f74f198b.js:3:9768435)
at G.invoke (polyfills.0210c03de943e1e6.js:1:7582)
at Object.onInvoke (main.1c883b45f74f198b.js:3:8816280)
at G.invoke (polyfills.0210c03de943e1e6.js:1:7522)
at at.run (polyfills.0210c03de943e1e6.js:1:2925)
at polyfills.0210c03de943e1e6.js:1:17891
at G.invokeTask (polyfills.0210c03de943e1e6.js:1:8201)

Steps to Reproduce

  • Set up an Angular application with esbuild.
  • Integrate Twilio Video Processors.
  • Ensure a strict Content Security Policy (CSP) is applied (without 'unsafe-eval').
  • Load the application and observe the WebAssembly-related error in the console.

Expected behavior:

The Twilio Video Processors library should load and function without requiring 'unsafe-eval' in CSP.

Actual behavior:

The application crashes due to WebAssembly instantiation being blocked by CSP.

Software versions:

  • Angular Version: 13
  • Build Tool: esbuild
  • Twilio Video Processors Version: 3.0.0
  • Browser: chrome
  • Hosting Environment: Local/VPS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions