Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [SOLVED] WebGL Build Error - "Unable to parse Build/[File Name].framework.js.br"

Discussion in 'Web' started by DwightDavis, May 1, 2021.

  1. DwightDavis

    DwightDavis

    Joined:
    Oct 19, 2019
    Posts:
    4
    THIS POST HAS BEEN SOLVED - FEEL FREE TO DELETE THIS THREAD

    Since last October I've been having issues with building WebGL files across several different versions of Unity. At first, I was running into an error where I could only build a functional WebGL build if I created a Development Build. Now even that workaround won't function. I haven't built a usable WebGL build in months, despite hours of online troubleshooting and retrying. I was hoping somebody here might be willing to help me out.

    My current version is Unity 2021.1.4f1.

    My newest build gave me an error message, shown below (my file is named "WebGL v1"):


    I also took a look in Chrome's developer tools console to investigate the error, shown below:


    Here are all of my build settings for WebGL:





    As for the project, it's a very simple platformer without any special plugins or packages in use. If you have any more questions about my build settings, my setup, or anything else, please let me know!

    Thanks for taking the time to help
     
    Last edited: May 1, 2021
  2. DwightDavis

    DwightDavis

    Joined:
    Oct 19, 2019
    Posts:
    4
    I solved the issue by changing the Compression Format to "Disabled"
     
  3. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    The root issue here is like the error message is suggesting: the web server that is being used is misconfigured, and does not advertise the

    Content-Encoding: br

    HTTP response header when serving the files with a .br suffix.

    Fixing this requires configuring the web server to be able to do network compression. As a workaround if you do not have access to server configuration, you can keep the compression but enable "Compression Fallback", in which case Unity embeds a Brotli decompressor into the build. This has performance implications but can serve as a functional workaround.
     
  4. mystefier

    mystefier

    Joined:
    Jul 17, 2016
    Posts:
    1
    I'm having the same problem. Can you let me know where to find the option to change the Compression Format?
     
    NubModel and heartingNinja like this.
  5. RayanAziz11

    RayanAziz11

    Joined:
    Aug 4, 2021
    Posts:
    5
    that is in player settings
     
    GanbarimasuPlus likes this.
  6. FoxbxHero

    FoxbxHero

    Joined:
    Dec 24, 2020
    Posts:
    1
    upload_2022-1-13_18-17-40.png
    for anyone having trouble finding the setting
     
  7. roguedagger

    roguedagger

    Joined:
    Jul 11, 2018
    Posts:
    5
    You still should not have to disable compression, that makes web files WAY too big. I am having the same problem, so I'll update if I find a solution that allows compression.
     
    godthekid likes this.
  8. unitygamedevloper48

    unitygamedevloper48

    Joined:
    Apr 9, 2022
    Posts:
    1
    If there is a same setting, then an error occurs
     
  9. ImOneIvan

    ImOneIvan

    Joined:
    Feb 11, 2022
    Posts:
    2
    I have the same problem.
    And I found out that if I create a 3D project, I don't have this error.
     
    heartingNinja likes this.
  10. ccfoo242

    ccfoo242

    Joined:
    Oct 9, 2014
    Posts:
    85
    Changing the compression to gzip under Publising Settings -> Compression Format solved this problem for me. Found solution HERE.
     
  11. Ottobed

    Ottobed

    Joined:
    Jul 6, 2020
    Posts:
    3
  12. SavedByZero

    SavedByZero

    Joined:
    May 23, 2013
    Posts:
    124
    No good -- this didn't fix it for me in unity 2020.3. The only thing that works is actually disabling compression -- neither format works on dreamhost.
     
    Last edited: Oct 5, 2022
    Abdul57, monoganog and alekpanc like this.
  13. ccfoo242

    ccfoo242

    Joined:
    Oct 9, 2014
    Posts:
    85
    I was using 2021.x
    Sucks that you have to disable compresw. I imagine that slows down the initial load time.
     
  14. SavedByZero

    SavedByZero

    Joined:
    May 23, 2013
    Posts:
    124
    Maybe it’s a dreamhost thing? But yeah, WebGL has always been very slow for us.
     
  15. nonbeing

    nonbeing

    Joined:
    Oct 14, 2022
    Posts:
    1
    Using 'zip' compression is working fine for me (2022.1) on itch.io - thanks for this solution.
     
    DBarlok, heartingNinja and Mikael-H like this.
  16. heartingNinja

    heartingNinja

    Joined:
    Mar 26, 2015
    Posts:
    28
    Compression Format seems to be set to "Brotli" by default. Changing to disable worked for me. But changing the format to "Gzip" also worked. I am using a .zip file to upload to Itch.
     
    DBarlok likes this.
  17. khrlazm

    khrlazm

    Joined:
    May 12, 2021
    Posts:
    1
    GZIP works.

    Thank you and have a good one
     
    heartingNinja likes this.
  18. gibrel

    gibrel

    Joined:
    Jan 4, 2013
    Posts:
    1
    Hello everyone.

    I had the same problem, but the solution I used was to enable Decompression Fallback over Publishing Settings.

    upload_2023-2-27_11-55-15.png

    Like in this video:
     
    Luis0413, LongEcho and DBarlok like this.
  19. ib_magar

    ib_magar

    Joined:
    Jan 2, 2022
    Posts:
    2
    Don't know how, but changing the compression format to disabled worked for me.
     

    Attached Files:

  20. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,951
    That means your compression is not supported by the target web server (they havent setup their headers etc correctly to handle brotli/gzip)

    You can get around this by checking "decompression fallback", rather than selecting no compression.
     
    LongEcho likes this.
  21. Zain_javaid55

    Zain_javaid55

    Joined:
    Aug 25, 2021
    Posts:
    1
    It worked. Thank you!
     
  22. RaduC94

    RaduC94

    Joined:
    Mar 20, 2023
    Posts:
    1
    You are a life saver! Thank you for your time to post your solution! ^^
     
  23. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    431
    This thread is like watching a lamp catch flies...

    Y'all do know that disabling compression doesn't fix the fact that your server is misconfigured to handle gzip/brotli right?
     
    bugfinders and jacobfdunbar like this.
  24. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    258
  25. Jaehaerys3301

    Jaehaerys3301

    Joined:
    Mar 25, 2023
    Posts:
    1
    the compression disabling fixed it thanks!
     
  26. bin-debug

    bin-debug

    Joined:
    Dec 25, 2022
    Posts:
    1
    I ran into the same problem now and done some stackoverflows and research on the forums. The error I am getting is :

    Unable to parse Build/PROJECTNAME.framework.js.br! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: br" present. Check browser Console and Devtools Network tab to debug.

    Unity Version : 2022.2.0f1

    In the publish settings settings I have tried all 3 compression formats Brotli, gzip and none. With toggling decompression fallback on/off. I also enabled Developer Build. Nothing I try works :(

    I am trying to get working in github pages. I also found a link on the unity docs where I created web.config files in the build folder and also uploaded that to github pages, nothing works.

    I tried it locally by running python -m http.server, that also does not work because it needs an http(s) server for some reason.

    Is there anything else I can try please, I dont want to create a new ticket so I am hoping somebody does pick this up...
     
    Jimaniki likes this.
  27. Tom02039

    Tom02039

    Joined:
    Oct 6, 2022
    Posts:
    1
    Thanks, this work
     
  28. diverges_unity

    diverges_unity

    Unity Technologies

    Joined:
    Mar 2, 2023
    Posts:
    3
    For folks encountering this issue. The default unity compression of 'Brotli' is not supported everywhere and usually results in the player not being able to load. This setting can be found under 'Project Settings > Player > WebGL > Publishing Settings > Compression Format'.

    Changing it to gzip should work in most cases (like for itch.io), this is preferable over disabling compression completely.
     
  29. Torukun_404

    Torukun_404

    Joined:
    Dec 14, 2021
    Posts:
    12
    I try to embed webgl onto my blazor project. I've try set compression format to gzip and eneble decompression fallback and yet still nothing works :(
     
    Jimaniki likes this.
  30. ValentineCat

    ValentineCat

    Joined:
    Feb 15, 2021
    Posts:
    10
    None of the suggestions work for me. Trying to deploy a very simple AR scene from the tutorial that I can see on my android to webGL and upload to itch.io. I'm still getting the error the original poster has. I tried gzip and disable compression. Please help.
     
    Jimaniki likes this.
  31. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    258
    @ValentineCat can you share the itchio link or the tutorial you followed?
     
  32. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    According to Itch.io's documentation at https://itch.io/docs/creators/html5#compression , it does state that they should support Unity's .br compressed files.

    If you are having issues with uploading Unity content that was compressed with Brotli, and has the suffix .*.br on disk, and you get a message "... web server hosting the content was misconfigured", then that really means that the problem is at their web server end. So that would be a bug at Itch.io's web server, or their uploading flow, or in the instructions they post on how to upload.

    One way to debug is to use the Network tab in a web browser to see what the actual response headers are. ( https://developer.chrome.com/docs/devtools/network/ ). The response headers should always carry two specific headers:

    Content-Encoding: br
    Content-Type: one of "application/wasm", or "application/javascript", or "application/octet-stream", depending on the file type.

    If these are not present, then the web server is not acting properly. If these are present, but the browser is still giving the red banner, then there is a bug either in the browser, or the headers are been subtly set wrong somehow.

    We are aware that in rare cases, a few browsers have up until recently had issues with handling Brotli and gzip content.

    Firefox:
    - https://bugzilla.mozilla.org/show_bug.cgi?id=1829309: Download of Brotli content fails with NS_ERROR_INVALID_CONTENT_ENCODING if Content-Type header is not set
    - https://bugzilla.mozilla.org/show_bug.cgi?id=1715401: Content Encoding Error received for a file with brotli content-encoding
    (the above are two faces of the same bug). These were fixed to Firefox 116 (current Firefox stable should be 117 by now)

    Safari:
    - https://bugs.webkit.org/show_bug.cgi?id=247421: Content downloaded with fetch() API when Content-Encoding: gzip is set is not decompressed.
    This issue affected Safari 16, and were fixed into an unknown later Safari version, since Apple does not publicize the versions that fixes actually ship in.

    But unless you may have been running an old browser version, the root problem should be as stated.

    Both enabling Decompression Fallback or Disabling Compression altogether do provide a workaround for misconfigured servers, but we strongly recommend against shipping games with either of these settings, since they will always result in suboptimal loading times. These options are provided as a last resort setting mostly for temporary development purposes. If you are currently using either of these settings, please consider revisiting that option if you are interested in optimizing load times. The benefit can be really big!

    If the issue has persisted for a while with Itch.io uploads, we recommend contacting Itch about it - and if they are adamant there should not be a problem at their end, and the problem still persists after following their official instructions, then please let us know.
     
    unityruba likes this.
  33. killerkosmos

    killerkosmos

    Joined:
    Oct 3, 2023
    Posts:
    1
    same issue here unfortunately
     
  34. YesUnO

    YesUnO

    Joined:
    Oct 2, 2023
    Posts:
    4
    Double check ur config and Build folder that it actually contains what u are referencing in config. When u are using "Compression format: disabled" u shouldnt be referencing .js.br file cause u didnt build it.

    The error msg is a bit missleading. probably should be not found. but maybe its not possible to tailor it?

    working repo here: https://github.com/YesUnO/CubePage (might be pretty ugly, first timing blazor so i just hacked it together somehow, but it works)
     
    Last edited: Oct 27, 2023
  35. Zlipperzz

    Zlipperzz

    Joined:
    Aug 15, 2023
    Posts:
    1
    yooo thank you. you saved my ass i needed to post this for school.