node-chromium icon indicating copy to clipboard operation
node-chromium copied to clipboard

Update getLatestRevisionNumber to match current folder structure

Open maxrandolph opened this issue 3 years ago • 3 comments

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.

maxrandolph avatar Aug 19 '21 20:08 maxrandolph

See https://github.com/dtolstyi/node-chromium/issues/44

maxrandolph avatar Aug 19 '21 20:08 maxrandolph

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.

image

maxrandolph avatar Aug 20 '21 20:08 maxrandolph

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.

maxrandolph avatar Aug 20 '21 20:08 maxrandolph