Skip to content

Cached browser not recognized. Trying to download new one. #684

@cuthulino

Description

@cuthulino

What version of Butler Sheet Icons are you using?

3.7.1 (latest available version for docker)

What version of Node.js are you using? Not applicable if you use the standalone version of Butler Sheet Icons.

v22.11.0 (docker included)

What command did you use to start Butler Sheet Icons?

node butler-sheet-icons.js qseow create-sheet-thumbnails --host hostname --certfile /secrets/certs/test/client.pem --certkeyfile /secrets/certs/test/client_key.pem --apiuserdir internal --apiuserid sa_api --loglevel debug --logonuserdir userdir --logonuserid username --logonpwd secret --prefix form --contentlibrary SheetPreviews --browser chrome --browser-version 130.0.6723.116 --sense-version 2024-May --appid abc-xyz

What operating system are you using?

Linux (Docker), also tested on Windows (see old issue)

What CPU architecture are you using?

x86_64 in docker

What Qlik Sense versions are you using?

May 2024

Describe the Bug

Now we can use Docker in out company and we are getting a newer version of qlik sense.
Because of that I again looked into Butler Sheet Icons to get a new Version running but I am struggling on the same spot like the last issue I opened (#568 ) which was closed to early.

browser list installed list the chrome browser from puppetier.
I moved it there manually because our servers are completely offline.
Image

But when I execute BSI, it tries to query the chrome API and fails.
Because we are offline.
Image

Expected Behavior

It should work offline if a browser is installed already.


The error is resulting from the canDownload check.

// Ensure browser can be downloaded
const canDownloadBrowser = await canDownload({
browser: options.browser,
buildId,
cacheDir: browserPath,
unpack: true,
});
if (!canDownloadBrowser) {
throw new Error(
`Browser "${options.browser}" version "${options.browserVersion}" cannot be downloaded. Please use the "list-available" command to check available versions`
);
}

It gets called in qseowProcessApp here:

const browserInstallResult = await browserInstall(options);
if (browserInstallResult === false) {
logger.error(`QSEoW APP: Error installing browser. Exiting.`);
process.exit(1);
}

The function from puppeteer calls a http api endpoint
https://github.com/puppeteer/puppeteer/blob/0dddb1d403374e96f8e95d6d95d0dedd49ef02fe/packages/browsers/src/install.ts#L456-L471

This fails on offline systems.

It would be great if isAvailableInCache (pseudo function) would be checked before the canDownload.
If already in the cache directory, there is no need for the download.
Else everything should run like before.

Puppeter got the function to check and it is used already to list-installed:

const browsersInstalled = await getInstalledBrowsers({
cacheDir: browserPath,
});
// Output installed browsers to info log
if (browsersInstalled.length > 0) {
logger.info(`Installed browsers:`);
browsersInstalled.forEach((browser) => {
logger.info(
` ${browser.browser}, build id=${browser.buildId}, platform=${browser.platform}, path=${browser.path} `
);
});
} else {

To Reproduce

  • Get Butler Sheet Icon
  • Get the browser in the right directory
  • Cut off internet connection

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions