foundryvtt-docker icon indicating copy to clipboard operation
foundryvtt-docker copied to clipboard

10.277.0 license agreement fails to render

Open felddy opened this issue 3 years ago • 6 comments

Discussed in https://github.com/felddy/foundryvtt-docker/discussions/398

Originally posted by eXaminator August 6, 2022 Hey, after pulling the latest image on my local machine (Docker for Mac) and starting it I get greeted by the license page as usual, but it stays empty: image

I also get an error in the browser console:

setup.js:112 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'addEventListener')
    at Setup._licenseView (setup.js:112:11)
    at Setup._initializeView (setup.js:88:21)
    at Setup.initialize (foundry.js:7379:16)

It seems to me, that the license agreement is not properly loaded and thus the JavaScript fails because it cannot find the checkbox on the page.

I'm running felddy/foundryvtt:prerelease in this case via docker-compose, passing only a username, password, admin key and license key via environment variables. I have mounted the /data directory (as well as 2 specific module directories and one system directory because I am working on those).

It worked flawlessly until this latest update. I tried to pull the image and recreate the container multiple times.

Here are the logs I get when starting the container:

Entrypoint | 2022-08-06 11:08:02 | [info] Starting felddy/foundryvtt container v10.277.0
Entrypoint | 2022-08-06 11:08:02 | [info] No Foundry Virtual Tabletop installation detected.
Entrypoint | 2022-08-06 11:08:02 | [info] Using FOUNDRY_USERNAME and FOUNDRY_PASSWORD to authenticate.
Authenticate | 2022-08-06 11:08:03 | [info] Requesting CSRF tokens from https://foundryvtt.com
Authenticate | 2022-08-06 11:08:04 | [info] Logging in as: examinator
Authenticate | 2022-08-06 11:08:06 | [info] Successfully logged in as: examinator
Entrypoint | 2022-08-06 11:08:06 | [info] Using authenticated credentials to download release.
ReleaseURL | 2022-08-06 11:08:07 | [info] Fetching S3 pre-signed release URL for build 277...
Entrypoint | 2022-08-06 11:08:08 | [info] Using CONTAINER_CACHE: /data/container_cache
Entrypoint | 2022-08-06 11:08:08 | [info] Downloading Foundry Virtual Tabletop release.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Entrypoint | 2022-08-06 11:08:09 | [info] Installing Foundry Virtual Tabletop 10.277
Entrypoint | 2022-08-06 11:08:14 | [info] Preserving release archive file in cache.
Entrypoint | 2022-08-06 11:08:14 | [info] Not modifying existing installation license key.
Entrypoint | 2022-08-06 11:08:14 | [info] Setting data directory permissions.
Entrypoint | 2022-08-06 11:08:28 | [info] Starting launcher with uid:gid as foundry:foundry.
Launcher | 2022-08-06 11:08:28 | [info] Generating options.json file.
Launcher | 2022-08-06 11:08:28 | [info] Setting 'Admin Access Key'.
Launcher | 2022-08-06 11:08:28 | [info] Starting Foundry Virtual Tabletop.
FoundryVTT | 2022-08-06 11:08:31 | [info] Running on Node.js - Version 16.16.0
FoundryVTT | 2022-08-06 11:08:31 | [info] Foundry Virtual Tabletop - Version 10 Build 277
FoundryVTT | 2022-08-06 11:08:31 | [info] User Data Directory - "/data"
FoundryVTT | 2022-08-06 11:08:31 | [info] Application Options:
{
  "awsConfig": null,
  "fullscreen": false,
  "hostname": null,
  "language": "en.core",
  "localHostname": null,
  "passwordSalt": null,
  "port": 30000,
  "protocol": null,
  "proxyPort": null,
  "proxySSL": false,
  "routePrefix": null,
  "sslCert": null,
  "sslKey": null,
  "updateChannel": "stable",
  "upnp": false,
  "upnpLeaseDuration": null,
  "world": null,
  "adminPassword": "••••••••••••••••",
  "compressStatic": true,
  "serviceConfig": null
}
FoundryVTT | 2022-08-06 11:08:31 | [error] Software license verification failed. Please confirm your Foundry Virtual Tabletop software license
FoundryVTT | 2022-08-06 11:08:31 | [info] Server started and listening on port 30000

I also get a ton of warnings due to modules not adhering to the latest module.json format. I also had one "error" due to a module not defining some dependency, so I just removed the module and restarted the container, to make sure that wasn't causing the issue.

Any ideas what could cause this error?

felddy avatar Aug 06 '22 22:08 felddy

@eXaminator I'm able to reproduce this with a clean (unlicensed) data directory on 10.277.0 with Firefox on Mac. The same setup but with 10.276.0 renders the license page correctly.

I do also see the exception in the browser's console with 10.277.0:

Uncaught (in promise) TypeError: input is null
    _licenseView http://localhost:30000/scripts/setup.js:112
    _initializeView http://localhost:30000/scripts/setup.js:88
    initialize http://localhost:30000/scripts/foundry.js:7379

I'm going to do some testing to see if I can determine the cause. This is feeling like a Foundry bug since only the container version changed since the last release: https://github.com/felddy/foundryvtt-docker/compare/v10.276.0...v10.277.0

felddy avatar Aug 06 '22 22:08 felddy

I just ran the 10.276.0 container while setting the FOUNDRY_VERSION environment variable to 10.277 so that the older container will install the newer server. The license page failed to render.

This reinforces my belief that this is a FoundryVTT issue.

Log showing forced version mismatch.

foundryvtt-docker-foundry-1  | Entrypoint | 2022-08-06 18:35:28 | [debug] Timezone set to: US/Eastern
foundryvtt-docker-foundry-1  | Entrypoint | 2022-08-06 18:35:28 | [info] Starting felddy/foundryvtt container v10.276.0
foundryvtt-docker-foundry-1  | Entrypoint | 2022-08-06 18:35:28 | [debug] CONTAINER_VERBOSE set.  Debug logging enabled.
foundryvtt-docker-foundry-1  | Entrypoint | 2022-08-06 18:35:28 | [warn] FOUNDRY_VERSION has been manually set and does not match the container's version.
foundryvtt-docker-foundry-1  | Entrypoint | 2022-08-06 18:35:28 | [warn] Expected 10.276 but found 10.277
foundryvtt-docker-foundry-1  | Entrypoint | 2022-08-06 18:35:28 | [warn] The container may not function properly with this version mismatch.

The error is coming from this block of code in setup.js:

  /**
   * The application view which displays the End User License Agreement (EULA).
   * @private
   */
  _licenseView() {
    ui.notifications = new Notifications().render(true);
    const setup = document.getElementById("setup");

    // Allow right-click specifically in the key field
    const input = document.getElementById("key");
    input.addEventListener("contextmenu", ev => ev.stopPropagation());

    // Render the EULA
    if ( setup.dataset.step === "eula" ) new EULA().render(true);
  }

Specifically const input = document.getElementById("key"); is returning null.

Next steps:

  • Since the Foundry developers are hesitant to deal with Docker containers, I'm going to see if I can reproduce this with a stand-alone node install.
  • Diff 10.276 and 10.277 to see what changed around the license panel.

felddy avatar Aug 06 '22 22:08 felddy

The code that is failing was added in 10.277:

--- 10.276/resources/app/public/scripts/setup.js	2022-07-28 20:00:18.000000000 -0400
+++ 10.277/resources/app/public/scripts/setup.js	2022-08-04 22:30:14.000000000 -0400
@@ -106,6 +106,12 @@
   _licenseView() {
     ui.notifications = new Notifications().render(true);
     const setup = document.getElementById("setup");
+
+    // Allow right-click specifically in the key field
+    const input = document.getElementById("key");
+    input.addEventListener("contextmenu", ev => ev.stopPropagation());
+
+    // Render the EULA
     if ( setup.dataset.step === "eula" ) new EULA().render(true);
   }

felddy avatar Aug 06 '22 22:08 felddy

I exec'd into the container and commented out lines 112:113 and reloaded the page in Firefox. The license rendered correctly.

  /**
   * The application view which displays the End User License Agreement (EULA).
   * @private
   */
  _licenseView() {
    ui.notifications = new Notifications().render(true);
    const setup = document.getElementById("setup");

    // Allow right-click specifically in the key field
    // const input = document.getElementById("key");
    // input.addEventListener("contextmenu", ev => ev.stopPropagation());

    // Render the EULA
    if ( setup.dataset.step === "eula" ) new EULA().render(true);
  }

felddy avatar Aug 06 '22 23:08 felddy

I think I know how to reproduce this behavior outside the container. I will open an issue with FoundryVTT and reference it back here.

felddy avatar Aug 06 '22 23:08 felddy

I'm having the same problem and got to the same conclusion as you before seeing this issue.

Doing docker exec -it into the container and launching Foundry manually makes it work without changing the command at all. I don't see what it changes. The only thing I have in mind is a race condition inside Foundry's code related to the page's render.

I mentioned the issue in Discord, but I was just told to get help from the image developer, which in my case is myself...

EDIT: Just saw that you referenced an issue in Foundry's official GitHub and a fix is coming

jstebenne avatar Aug 11 '22 03:08 jstebenne

I have started getting this exact same error while trying to run v11.xxx from a docker-compose file. I tested multiple v11 images, disabled my saved data, tried various env variables, and 4 different browsers and they all return this same error message. Is it possible the fix applied to the v10 images was not applied to v11?

brucetony avatar May 24 '23 11:05 brucetony