node-chromium
node-chromium copied to clipboard
Update getLatestRevisionNumber to match current folder structure
As of 08/18/21, chromium binaries seem to be stored now in folder prefixed with refs_head_main-
, followed by the revision number. This PR is a quick and dirty fix for this issue.
It's unclear if this is a storage policy change or a code change on the Chromium side.
See https://github.com/dtolstyi/node-chromium/issues/44
The code changed could probably be cleaned up but will reattempt to download in the event that a HEAD
request to standard form of the chromium binaries returns a 404/erroneous response. Second attempt will append the refs_head_main-
prefix which seems to be alternating in the LAST_CHANGE
version referenced on the googleapis storage site. For instance in the attached image, LAST_CHANGE
contains 913626
, which resolves to the normal URL. It seems that sometimes however, LAST_CHANGE
will contain a number which is part of the refs_heads_main-
revision numbers, in which case the chromium download will fail without appending the refs_heads_main-
prefix to the location chromium is downloaded from.
If error is still present after adding refs_heds_main-
prefix, the request will fail and throw error, as that will indicate something else is wrong.