WebAssembly streaming compilation failed! This can happen for example if "Content-Encoding" HTTP

Im trying to add unity webGL file on my website which is 000webhost. But i cant do it. Im always taking like this error

WebAssembly streaming compilation failed! This can happen for example if “Content-Encoding” HTTP header is incorrectly enabled on the server for file Build/build.wasm, but the file is not pre-compressed on disk (or vice versa).



3 Likes

I got the same issue, did you by any chance find a solution for this?

The web server used to host Unity content should be configured to set the following HTTP Response Headers on the build.wasm.gz file:

Content-Type: application/wasm
Content-Encoding: gzip

or if you have a Brotli-compressed build.wasm.br file:

Content-Type: application/wasm
Content-Encoding: br

(likewise all other *.gz files should get Content-Encoding: gzip and all other *.br files should get Content-Encoding: br)

I haven’t used 000webhost so I don’t know how they’d do this there. If you’ve consulted their documentation and find they have no mechanism to allow setting HTTP Response Headers, then you have two fallback options:

  1. Enable the “Decompression fallback” option in Unity build settings, or
  2. set Compression to None in build settings.

These fallbacks have the unfortunate effect of slowing down page startup, so it is definitely recommended to enable those headers on 000webhost webhost if at all possible.