Search Unity

Question [Unity 2020.3.4] Trouble with webgl only on certain machines

Discussion in 'Web' started by Domcoc, May 19, 2021.

  1. Domcoc

    Domcoc

    Joined:
    Sep 1, 2017
    Posts:
    11
    Hello
    I've made a project using webgl and I've uploaded it on remote server. When I connect to the URL using my desktop pc I can play with it without problem. However when I try to access it through my new laptop it freezes before Unity logo appears. The browser I use is Firefox 88.0.1 on both machines. I've tried also on another laptop and it works! I think I'm missing some library on the new laptop but I can't figure out which one.

    Here there is my console log, any help will be very appreciated. Thanks

    Uncaught (in promise) abort({}) at jsStackTrace@http://domcoc.altervista.org/DVRplus_Plan/Build/DVRplus_Plan.framework.js:2:16316 stackTrace@http://domcoc.altervista.org/DVRplus_Plan/Build/DVRplus_Plan.framework.js:2:16487 abort@http://domcoc.altervista.org/DVRplus_Plan/Build/DVRplus_Plan.framework.js:2:748 instantiateArrayBuffer/<@http://domcoc.altervista.org/DVRplus_Plan/Build/DVRplus_Plan.framework.js:2:25342
    The Gamepad API will only be available in secure contexts (e.g., https). Please see https://hacks.mozilla.org/2020/07/securing-gamepad-api/ for more info. DVRplus_Plan.framework.js:2:199231
    wasm streaming compile failed: TypeError: WebAssembly: Response has unsupported MIME type 'text/plain' expected 'application/wasm' DVRplus_Plan.loader.js:1:4529
    falling back to ArrayBuffer instantiation DVRplus_Plan.loader.js:1:4529
    [UnityCache] 'http://domcoc.altervista.org/DVRplus_Plan/Build/DVRplus_Plan.data' successfully revalidated and served from the indexedDB cache DVRplus_Plan.loader.js:1:7510
    failed to asynchronously prepare wasm: LinkError: import object field '_JS_SystemInfo_GetMatchWebGLToCanvasSize' is not a Function DVRplus_Plan.loader.js:1:4529
    LinkError: import object field '_JS_SystemInfo_GetMatchWebGLToCanvasSize' is not a Function DVRplus_Plan.loader.js:1:4492
    LinkError: import object field '_JS_SystemInfo_GetMatchWebGLToCanvasSize' is not a Function DVRplus_Plan.loader.js:1:4529
    Uncaught (in promise) abort({}) at jsStackTrace@http://domcoc.altervista.org/DVRplus_Plan/Build/DVRplus_Plan.framework.js:2:16316 stackTrace@http://domcoc.altervista.org/DVRplus_Plan/Build/DVRplus_Plan.framework.js:2:16487 abort@http://domcoc.altervista.org/DVRplus_Plan/Build/DVRplus_Plan.framework.js:2:748 instantiateArrayBuffer/<@http://domcoc.altervista.org/DVRplus_Plan/Build/DVRplus_Plan.framework.js:2:25342
     
  2. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    288
    I think it's because I'm accessing it via http: // ~ as shown in the error.
    Please access at https: // ~.
     
  3. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    I believe here the error "The Gamepad API will only be available in secure contexts" is not the actual root cause of the issue. The actual cause looks like is

    failed to asynchronously prepare wasm: LinkError: import object field '_JS_SystemInfo_GetMatchWebGLToCanvasSize' is not a Function DVRplus_Plan.loader.js:1:4529
    LinkError: import object field '_JS_SystemInfo_GetMatchWebGLToCanvasSize' is not a Function DVRplus_Plan.loader.js:1:4492
    LinkError: import object field '_JS_SystemInfo_GetMatchWebGLToCanvasSize' is not a Function DVRplus_Plan.loader.js:1:4529

    Which looks like some kind of incoherency in serving the downloaded files: I wonder if the .wasm and the .framework.js are somehow out of sync? I.e. running a new version of one, but an old version of the other? Can you try clearing the browser cache, and/or disabling the "Data Caching" option in project build settings, to see if either of those clear out the issue? Or try another browser with a clean cache to see if it is a caching issue?
     
  4. Domcoc

    Domcoc

    Joined:
    Sep 1, 2017
    Posts:
    11
    Thanks for the answers.
    I've tryed disabling Data Catching as suggested but doesn't seem to fix the problem. I've also switched to the default webgl template, and this is what it happens at the end of the loading screen:

    upload_2021-5-24_12-32-29.png

    Then I tried to migrate the project to a https server and it works! Ironically when I try to run the project on the http server throught other machines it works, maybe there is a security feature that doesn't allow me to run the project on my new laptop on a http server. It also seems to be an issue of this particular project, since when I try to run a blank webgl project it works. I will make other attempts and I will let you know.
     
  5. Domcoc

    Domcoc

    Joined:
    Sep 1, 2017
    Posts:
    11
    Ok the problem seems to be fixed but I really don't know why!
    First I noticed that in my project there are two Canvas active at the start of the scene. So I've disabled one of them and rebuilt. Tryed on my "Not working new laptop" on the http server and it works. So I thought that the problem was in the Canvas. To be sure I re-enabled the second canvas and rebuilt. It still works! I assure you that this was the only change made in my project.
    Tried also clearing the browser catche and the result doesn't change.
    I'm pretty sure that the problem was caused by the Canvas, since now the line

    failed to asynchronously prepare wasm: LinkError: import object field '_JS_SystemInfo_GetMatchWebGLToCanvasSize' is not a Function

    doesn't appear anymore. Now I'm really hoping this issue (as any "self-fixing" issue) doesn't occur again.
     
  6. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    I think the issue does suggest that this was something about browser caching (not Unity's Data Caching): moving from http to https would cause the browser to think it was a new web site (as it was on a different location), and it would not use an old cache.

    That is probably why it also started working on http when you went back to it.

    These kinds of issues are a bit tricky. Unity should be instructing the browser to use Last-Modified and ETag fields for driving caching, but this sounds like there might be some kind of fluke in there. We don't get many reports like this, so if you find a deterministic way to reproduce the issue, we'd really love to know more about the steps.
     
  7. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I don't know if this is the same problem, but I just updated a number of projects to Unity 2020 (I've tried 2020.3.9f1 & 2020.3.11f1), and NONE of them will now run in Firefox (different versions, macOS and Win). They run in Edge, Chrome, and Safari (sound problems in Safari). Here's the JS console from one that wouldn't run:

    The script from “http://www.polyhedronlearning.com/p...uild/rbc_RayBoxRefractionCell.framework.js.gz” was loaded even though its MIME type (“application/gzip”) is not a valid JavaScript MIME type. rbc_RayBoxRefractionCell

    Uncaught SyntaxError: illegal character U+001F rbc_RayBoxRefractionCell.framework.js.gz:1

    Uncaught ReferenceError: unityFramework is not defined onload http://www.polyhedronlearning.com/ppsims/rbc_RayBoxRefractionCell/Build/rbc RayBoxRefractionCell.loader.js:1
    Here's another:

    TypeError: window is undefined
    browsing-context.js:1378:5

    Exception { name: "NS_ERROR_NOT_AVAILABLE", message: "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDocShell.domWindow]", result: 2147746065, filename: "resource://devtools/server/actors/targets/browsing-context.js", lineNumber: 402, columnNumber: 0, data: null, stack: "get window@resource://devtools/server/actors/targets/browsing-context.js:402:5\n_windowReady@resource://devtools/server/actors/targets/browsing-context.js:1418:24\nwatch@resource://devtools/server/actors/targets/browsing-context.js:1669:25\n_onDocShellCreated/<@resource://devtools/server/actors/targets/browsing-context.js:851:32\nexports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:103:22\n", location: XPCWrappedNative_NoHelper }
    ThreadSafeDevToolsUtils.js:82:13

    Exception { name: "NS_ERROR_NOT_AVAILABLE", message: "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDocShell.domWindow]", result: 2147746065, filename: "resource://devtools/server/actors/targets/browsing-context.js", lineNumber: 402, columnNumber: 0, data: null, stack: "get window@resource://devtools/server/actors/targets/browsing-context.js:402:5\n_windowReady@resource://devtools/server/actors/targets/browsing-context.js:1418:24\nDebuggerProgressListener.prototype.onWindowCreated<@resource://devtools/server/actors/targets/browsing-context.js:1764:23\nexports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:103:22\nDebuggerProgressListener.prototype.onStateChange<@resource://devtools/server/actors/targets/browsing-context.js:1854:20\nexports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:103:22\n", location: XPCWrappedNative_NoHelper }
    ThreadSafeDevToolsUtils.js:82:13

    Exception { name: "NS_ERROR_NOT_AVAILABLE", message: "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDocShell.domWindow]", result: 2147746065, filename: "resource://devtools/server/actors/targets/browsing-context.js", lineNumber: 402, columnNumber: 0, data: null, stack: "get window@resource://devtools/server/actors/targets/browsing-context.js:402:5\n_willNavigate@resource://devtools/server/actors/targets/browsing-context.js:1448:22\nDebuggerProgressListener.prototype.onStateChange<@resource://devtools/server/actors/targets/browsing-context.js:1859:25\nexports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:103:22\n", location: XPCWrappedNative_NoHelper }
    ThreadSafeDevToolsUtils.js:82:13

    Exception { name: "NS_ERROR_NOT_AVAILABLE", message: "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDocShell.domWindow]", result: 2147746065, filename: "resource://devtools/server/actors/targets/browsing-context.js", lineNumber: 402, columnNumber: 0, data: null, stack: "get window@resource://devtools/server/actors/targets/browsing-context.js:402:5\n_navigate@resource://devtools/server/actors/targets/browsing-context.js:1505:24\nDebuggerProgressListener.prototype.onStateChange<@resource://devtools/server/actors/targets/browsing-context.js:1888:27\nexports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:103:22\n", location: XPCWrappedNative_NoHelper }
    ThreadSafeDevToolsUtils.js:82:13

    Exception { name: "NS_ERROR_NOT_AVAILABLE", message: "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDocShell.domWindow]", result: 2147746065, filename: "resource://devtools/server/actors/targets/browsing-context.js", lineNumber: 402, columnNumber: 0, data: null, stack: "get window@resource://devtools/server/actors/targets/browsing-context.js:402:5\n_windowReady@resource://devtools/server/actors/targets/browsing-context.js:1418:24\nDebuggerProgressListener.prototype.onWindowCreated<@resource://devtools/server/actors/targets/browsing-context.js:1764:23\nexports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:103:22\n", location: XPCWrappedNative_NoHelper }
    columnNumber: 0
    data: null
    filename: "resource://devtools/server/actors/targets/browsing-context.js"
    lineNumber: 402
    location: XPCWrappedNative_NoHelper { QueryInterface: QueryInterface(), filename: Getter, name: Getter, … }
    message: "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDocShell.domWindow]"
    name: "NS_ERROR_NOT_AVAILABLE"
    result: 2147746065
    stack: "get window@resource://devtools/server/actors/targets/browsing-context.js:402:5\n_windowReady@resource://devtools/server/actors/targets/browsing-context.js:1418:24\nDebuggerProgressListener.prototype.onWindowCreated<@resource://devtools/server/actors/targets/browsing-context.js:1764:23\nexports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:103:22\n"
    " class="tree-node" role="treeitem" aria-level="2" aria-expanded="false" data-expandable="true">

    " class="tree-node" role="treeitem" aria-level="2" aria-expanded="false" data-expandable="true">
    <prototype>: ExceptionPrototype { toString: toString(), name: Getter, message: Getter, … }
    ThreadSafeDevToolsUtils.js:82:13​