Home > Enterprise >  "CompileError: WebAssembly.instantiateStreaming(): Wasm code generation disallowed by embedder&
"CompileError: WebAssembly.instantiateStreaming(): Wasm code generation disallowed by embedder&

Time:08-12

I am using rust wasm to make a chrome extension and I have been running into this problem for a while. Whenever chrome (or edge) is updated past version 101, the wasm does not work. I usually solve this by manually downgrading chrome, but this is annoying and seems like a bug.

CodePudding user response:

Working from @w0xx0m's comment, I started to adjust the content_security_policy in the extension's manifest.json file.

Adding the code below fixed the error.

  "content_security_policy": {
    "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; default-src 'self';"
  },

Make sure to take note of default-src 'self';; the extension will not load without it.

  • Related