Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Unity game WebGL hosting issue [UnityCache] Error when initializing cache

Discussion in 'Editor & General Support' started by pawelkosi, Apr 18, 2022.

  1. pawelkosi

    pawelkosi

    Joined:
    Jun 15, 2020
    Posts:
    2
    Hi guys,

    New to WebGL builds.
    I've been testing whole deployment pipeline for WebGL projects. Created a simple game, it compiles and runs fine on my PC. Created a WebGL build, and dropped the game to my Ubuntu server (20.04 LTS) and I get the following error:

    Code (JavaScript):
    1. [UnityCache] Error when initializing cache: Error: Could not connect to cache: Cache API is not supported.
    2.  
    3. Build.loader.js:1 [UnityCache] Failed to load 'http://[my_test_site_address_here]/unity_files/Build/Build.data.gz' from indexedDB cache due to the error: Error: Could not connect to cache: Cache API is not supported.
    4.  
    5. Uncaught SyntaxError: Invalid or unexpected token (at Build.framework.js.gz:1:1)


    I have disabled cache in the player settings and recompiled but still the same happens.

    Should it matter I have embedded the game files in .Net Core 5 app (the only change this required was changing paths to static files ie the js and gz files - but the paths check out).

    Also since this is test server there is no SSL cert set up, again providing that info should it be relevant.

    Any help would be greatly appreciated.
     
  2. zhuMissYou

    zhuMissYou

    Joined:
    Jan 26, 2019
    Posts:
    3
  3. kingstone426

    kingstone426

    Joined:
    Jun 21, 2013
    Posts:
    43
    I am running into the same issue.

    Your link seems to be broken. Also, would you mind posting the code needed to simply patch the Cache API bug?
     
  4. bfaliuperspectives

    bfaliuperspectives

    Joined:
    Feb 10, 2021
    Posts:
    13
    Same problem here.
    Appeared when i upgraded my project from Unity 2021.2.30 to 2022.1.19.
    Project is deployed on a Windows IIS and since we upgraded Unity, addressables cache is not working anymore and we get this error in the browser console log :

    [UnityCache] Error when initializing cache: Error: Could not connect to cache: Cache API is not supported.

    [UnityCache] Failed to load 'xxxxx.data.gz' from indexedDB cache due to the error: Error: Could not connect to cache: Cache API is not supported.
     
  5. AndreaGalet

    AndreaGalet

    Joined:
    May 21, 2020
    Posts:
    63
  6. seancheno

    seancheno

    Joined:
    Mar 16, 2021
    Posts:
    7
    Bump. Having same issue with cache since upgrading to 2022.3.0f1
     
  7. AndreaGalet

    AndreaGalet

    Joined:
    May 21, 2020
    Posts:
    63
    Check if your site is http, mine is working on https
     
  8. AndyBlock

    AndyBlock

    Joined:
    Oct 12, 2016
    Posts:
    27
    I was also hitting this issue. Although obviously not a 'real' solution, perhaps it is useful for others to know that switching the 'development build' toggle on fixed this for me. For the record, I was also using http rather than https.
     
  9. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    814
    oddly i just encountered this and its downloading the build file super slow, its like 40mb, its feeling like its trying to do a few gb.. i never noticed these errors before, but then the speed was OK, its weird because it was working fine, and
     
  10. Argenuto

    Argenuto

    Joined:
    Apr 7, 2014
    Posts:
    5
    It was erased