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

Better error message when downloading windows installer

Open mikelococo opened this issue 3 years ago • 2 comments

🚀 Feature Proposal

Emit a more beginner-friendly error message in the scenario when:

  • You use the FOUNDRY_RELEASE_URL environment variable to fetch the foundry package via a timed url
  • You mistakenly download the wrong package format by accident (like downloading the windows installer)

The current error message is simply unzip: short read which doesn't point you much in the right direction for finding your mistake. See the following log snippet:

  49   | [foundryvtt] Entrypoint | 2022-01-30 05:13:43 | [debug] Timezone set to: UTC
  50   │ [foundryvtt] Entrypoint | 2022-01-30 05:13:43 | [info] Starting felddy/foundryvtt container v9.245.0
  51   │ [foundryvtt] Entrypoint | 2022-01-30 05:13:43 | [debug] CONTAINER_VERBOSE set.  Debug logging enabled.
  52   │ [foundryvtt] Entrypoint | 2022-01-30 05:13:43 | [info] No Foundry Virtual Tabletop installation detected.
  53   │ [foundryvtt] Entrypoint | 2022-01-30 05:13:43 | [info] Using FOUNDRY_RELEASE_URL to download release.
  54   │ [foundryvtt] Entrypoint | 2022-01-30 05:13:43 | [info] Using CONTAINER_CACHE: /data/container-cache
  55   │ [foundryvtt] Entrypoint | 2022-01-30 05:13:43 | [info] Downloading Foundry Virtual Tabletop release.
  56   │ [foundryvtt]   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  57   │ [foundryvtt]                                  Dload  Upload   Total   Spent    Left  Speed
  58   │ [foundryvtt] 
  59   │ [foundryvtt]   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  60   │ [foundryvtt]   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  61   │ [foundryvtt]   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  62   │ [foundryvtt] Entrypoint | 2022-01-30 05:13:43 | [info] Installing Foundry Virtual Tabletop 9.245
  63   │ [foundryvtt] unzip: short read

It would be relatively straightforward to check the file format and emit a more beginner friendly error message, and would probably save folks some time.

Motivation

It's really easy to stumble on this problem. The default operating system in the Foundry license page is windows, so if you forget to switch to the node package this will happen to you.

The filenames produced by the container download process look perfectly normal, so if you casually inspect the container-cache directory you have no reason to suspect any problems. Below is an example container-cache directory after downloading the wrong foundry package format. Notice that every file is named correctly and claims to be a zip file. But if you use the file command to do magic header inspection, the most recent file is a PE32 executable downloaded because I forgot to flip the OS in the licenses page.

$ docker exec -it foundry sh
/home/foundry # apk add file
<... apk installation output snipped... but the file command gets installed...>
/home/foundry # cd /data/container-cache
/data/container-cache # file *
foundryvtt-0.7.10.zip: Zip archive data, at least v2.0 to extract, compression method=deflate
foundryvtt-0.8.9.zip:  Zip archive data, at least v2.0 to extract, compression method=deflate
foundryvtt-9.238.zip:  Zip archive data, at least v2.0 to extract, compression method=deflate
foundryvtt-9.242.zip:  Zip archive data, at least v2.0 to extract, compression method=deflate
foundryvtt-9.245.zip:  PE32 executable (GUI) Intel 80386, for MS Windows, Nullsoft Installer self-extracting archive

This has happened before and resulted in pretty extensive troubleshooting for such a simple problem to fix in https://github.com/felddy/foundryvtt-docker/issues/113. I've been tripped up this way myself more than once... but it happens infrequently enough that I always forget what's wrong and have to figure it out from scratch. I expect others will have trouble and end up asking for assistance as well. It feels pretty straightforward to check the file-format and bug out if it's unexpected.

Example

Using the output of the file command or some other validation mechanism (does curl know anything about mime types?), catch this common user-error and emit a helpful message along the lines of "We were able to use the FOUNDRY_RELEASE_URL to download a foundry installer package, but it doesn't look like a Linux/Nodejs zip file. This can happen when you provide a URL to the windows installer by mistake."

Pitch

Save users debugging time, save you from fielding repeated bug reports like https://github.com/felddy/foundryvtt-docker/issues/113.

mikelococo avatar Jan 30 '22 05:01 mikelococo

For completeness, here's the file output for the OSX dmg:

$ file FoundryVTT-9.245.dmg
FoundryVTT-9.245.dmg: zlib compressed data

It's unique from both the windows and the node/linux output, so each of the three installers can be disambiguated.

mikelococo avatar Jan 30 '22 21:01 mikelococo

This is a solid proposal. 💪 I agree that it would make a great addition to help mitigate a common pitfall. Thank you for the write up, and the related PR.

felddy avatar Feb 01 '22 14:02 felddy