Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Unhandled promise rejection: RangeError: Maximum call stack size exceeded on MacOS Safari

Discussion in 'Web' started by MikkoK-HS, Mar 24, 2022.

  1. MikkoK-HS

    MikkoK-HS

    Joined:
    Sep 26, 2017
    Posts:
    53
    Hi

    I've run into this error on MacOS Safari version 15.4 on line 149 in [projectname].loader.js when trying to load the build.

    I'm using Unity 2021.2.16 on Windows 10, WebGL 2.0 and the default WebGL template with only slight appearance modifications. What could be causing this?
     
    Last edited: Mar 24, 2022
    sampenguin likes this.
  2. BlasinRee

    BlasinRee

    Joined:
    Jul 18, 2019
    Posts:
    1
    same on 2021.3.6
     
  3. andym_sv

    andym_sv

    Joined:
    Mar 3, 2017
    Posts:
    10
    I'm also seeing this on Safari builds , WebGL 2.0.
    Unity 2021.3.5f1
    The same builds are working fine on Chrome/Edge.
     
  4. sampenguin

    sampenguin

    Joined:
    Feb 1, 2011
    Posts:
    64
    Likewise, hitting this same problem in Safari + Unity 2021.3.5f1 WebGL builds. I JUST got Safari working in a previous Unity version (but needed to upgrade for a different bug fix) too ‍♂️

    Similar older issues are mentioned as caching problems in various threads, but this is definitely not fixed by clearing Safari's caches. It's a bug in the loader.js file
    var d = String.fromCharCode.apply(null, e.subarray(r, r + i));
     
  5. sampenguin

    sampenguin

    Joined:
    Feb 1, 2011
    Posts:
    64
    More info in case it helps anyone:
    This error doesn't occur when I do a manual build of the exact same bits and run it through a local web server. It only happens in a staging environment after an automated Azure pipeline build. So now I'm trying to figure out how to diff what the automated build is doing differently.
     
  6. sampenguin

    sampenguin

    Joined:
    Feb 1, 2011
    Posts:
    64
    I'm seeing different browser behavior depending on the web server behind servicing identical builds. Curious if anyone else is experiencing this is serving from IIS/Apache/nginx or what?

    I'm specifically seeing the broken behavior when the bits are being served from IIS, vs. it works on Apache (with as many identical config settings as possible).
     
  7. sampenguin

    sampenguin

    Joined:
    Feb 1, 2011
    Posts:
    64
    For anyone still having this issue, I found a fix in my case: Switch to Brotli compression instead of gzip (and make sure your web server is configured to send the right type headers etc. for Brotli, per this https://docs.unity3d.com/Manual/webgl-server-configuration-code-samples.html ) Now works in latest Chrome, Firefox and Safari.

    I tried a million different tweaks of IIS settings against Safari and hardened up my build process scripts, but kept getting same results. What led me to trying this was stumbling across something that mentioned an old Safari bug (https://stackoverflow.com/questions/1235116/safari-and-gzip) where gzip wasn't handled correctly... I suspect that there may still be some sneaky related variant somehow with IIS + Unity's js + gzip + safari 16, because one other thing I noticed was a 2 byte difference in response sizes on the Unity js.gz files in Safari vs. what Chrome/Firefox reported.
     
    gfoxworthy likes this.
  8. royi-mat

    royi-mat

    Joined:
    Jan 23, 2021
    Posts:
    7
    hi, what if changing the compression method from Gzip to Brotli is not an option for me? sounds too weird to me that this is the only solution. everything was working fine (with Gzip compression) until now with unity version 2020.3.30, only after upgrading to unity 2021.3.13 the problem appears, so I must guess that there is a connection to unity version change and safari should not be to blame here.
     
  9. royi-mat

    royi-mat

    Joined:
    Jan 23, 2021
    Posts:
    7
    so what i did eventually is to turn on the flag of "webGLDecompressionFallback" in the build settings, this option does not compress the files with a certain method (gz / br) but rather as ".unityweb" but apparently it can have performance cost (i didn't felt any)