Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PCR] ERROR: Failed to download Chromium after retry 3 times. #10

Closed
NicerDicerPro opened this issue Mar 20, 2023 · 32 comments
Closed

[PCR] ERROR: Failed to download Chromium after retry 3 times. #10

NicerDicerPro opened this issue Mar 20, 2023 · 32 comments

Comments

@NicerDicerPro
Copy link

NicerDicerPro commented Mar 20, 2023

After updating to puppeteer-chromium-resolver 19.2.0 i can no longer build my docker image with it because the PUPPETEER_SKIP_CHROMIUM_DOWNLOAD env seems to be ignored.

package.json:

...
"puppeteer-chromium-resolver": "^19.2.0"
...

Dockerfile

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser

When building my docker container PCR tries to download docker, fails and the build of my docker container fails:

#14 48.66 [5/5] Building fresh packages...
#14 56.00 error /app/node_modules/puppeteer-chromium-resolver: Command failed.
#14 56.00 Exit code: 1
#14 56.00 Command: node ./lib/install.js
#14 56.00 Arguments: 
#14 56.00 Directory: /app/node_modules/puppeteer-chromium-resolver
#14 56.00 Output:
#14 56.00 [PCR] Chromium revision: 1095492
#14 56.00 [PCR] Not found local chromium
#14 56.00 [PCR] HEAD request: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1095492/chrome-linux.zip - true (315ms)
#14 56.00 [PCR] HEAD request: https://npmmirror.com/mirrors/chromium-browser-snapshots/Linux_x64/1095492/chrome-linux.zip - false (6092ms)
#14 56.00 [PCR] Downloading from: https://storage.googleapis.com ...
#14 56.00 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 56.00 [PCR] Retry Chromium downloading ... 
#14 56.00 [PCR] Downloading from: https://storage.googleapis.com ...
#14 56.00 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 56.00 [PCR] Retry Chromium downloading ... 
#14 56.00 [PCR] Downloading from: https://storage.googleapis.com ...
#14 56.00 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 56.00 [PCR] Retry Chromium downloading ... 
#14 56.00 [PCR] Downloading from: https://storage.googleapis.com ...
#14 56.00 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 56.00 [PCR] ERROR: Failed to download Chromium after retry 3 times.
#14 56.00 /app/node_modules/puppeteer-chromium-resolver/lib/index.js:96
#14 56.00         executablePath: options.revisionInfo.executablePath
#14 56.00                                              ^
#14 56.00 
#14 56.00 TypeError: Cannot read properties of undefined (reading 'executablePath')
#14 56.00     at launchHandler (/app/node_modules/puppeteer-chromium-resolver/lib/index.js:96:46)
#14 56.00     at PCR (/app/node_modules/puppeteer-chromium-resolver/lib/index.js:228:15)
#14 56.00 
#14 56.00 Node.js v18.12.1
#14 56.00 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Even if the downloading of chromium would work, i did set PUPPETEER_SKIP_CHROMIUM_DOWNLOAD so the download of chromium should not be happening.

When switching back to "puppeteer-chromium-resolver": "19.1.0" everything works fine again.

Did any undocumented changes regarding the PUPPETEER_SKIP_CHROMIUM_DOWNLOAD happen or am i missing something?

@cenfun
Copy link
Owner

cenfun commented Mar 20, 2023

Just roll back puppeteer-core to the previous version 19.7.3 works well, guess puppeteer-core made some incompatible changes, I will check it ASAP
puppeteer-chromium-resolver 19.2.0 + puppeteer-core 19.7.5 failed
puppeteer-chromium-resolver 19.2.0 + puppeteer-core 19.7.4 failed
puppeteer-chromium-resolver 19.2.0 + puppeteer-core 19.7.3 works

@cenfun
Copy link
Owner

cenfun commented Mar 20, 2023

very curious it works now
can you clean cache and try again.
make sure latest version installed.

@NicerDicerPro
Copy link
Author

NicerDicerPro commented Mar 21, 2023

Cant confirm that.

...
"puppeteer": "^19.7.4",
"puppeteer-chromium-resolver": "^19.2.0",
...

after clearing the yarn cache and reinstalling everything still results in the following error:

#14 176.8 error /app/node_modules/puppeteer-chromium-resolver: Command failed.
#14 176.8 Exit code: 1
#14 176.8 Command: node ./lib/install.js
#14 176.8 Arguments: 
#14 176.8 Directory: /app/node_modules/puppeteer-chromium-resolver
#14 176.8 Output:
#14 176.8 [PCR] Chromium revision: 1095492
#14 176.8 [PCR] Not found local chromium
#14 176.8 [PCR] HEAD request: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1095492/chrome-linux.zip - true (343ms)
#14 176.8 [PCR] HEAD request: https://npmmirror.com/mirrors/chromium-browser-snapshots/Linux_x64/1095492/chrome-linux.zip - true (7627ms)
#14 176.8 [PCR] Downloading from: https://storage.googleapis.com ...
#14 176.8 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 176.8 [PCR] Retry Chromium downloading ... 
#14 176.8 [PCR] Downloading from: https://storage.googleapis.com ...
#14 176.8 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 176.8 [PCR] Retry Chromium downloading ... 
#14 176.8 [PCR] Downloading from: https://storage.googleapis.com ...
#14 176.8 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 176.8 [PCR] Retry Chromium downloading ... 
#14 176.8 [PCR] Downloading from: https://storage.googleapis.com ...
#14 176.8 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 176.8 [PCR] ERROR: Failed to download Chromium after retry 3 times.
#14 176.8 /app/node_modules/puppeteer-chromium-resolver/lib/index.js:96
#14 176.8         executablePath: options.revisionInfo.executablePath
#14 176.8                                              ^
#14 176.8 
#14 176.8 TypeError: Cannot read properties of undefined (reading 'executablePath')
#14 176.8     at launchHandler (/app/node_modules/puppeteer-chromium-resolver/lib/index.js:96:46)
#14 176.8     at PCR (/app/node_modules/puppeteer-chromium-resolver/lib/index.js:228:15)
#14 176.8     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
#14 176.8 
#14 176.8 Node.js v18.12.1

Downgrading to PCR 19.1.0 still solves the issue.

If i can help you somehow by providing additional testing/information please feel free to let me know, im happy to collaborate.

@cenfun
Copy link
Owner

cenfun commented Mar 21, 2023

do you have a chance to try puppeteer: v19.7.5?

In fact, we do not recommend using puppeteer-chromium-resolver + puppeteer, can you remove puppeteer from your package.json dependencies? or it's a upstream dependence?

since puppeteer-chromium-resolver already depends on puppeteer-core (not puppeteer), so i guess maybe there are some uncertainty. welcome to provide more infomations thanks.

@NicerDicerPro
Copy link
Author

NicerDicerPro commented Mar 27, 2023

Actually we only use puppeteer-core and puppeteer-element2selector but never puppeteer itself in our code.
So maybe removing puppeteer from our dependencies is possible since puppeteer-core will be installed via peer dependencies via puppeteer-chromium-resolver anyways.

Ill give it a try and let you know if that worked.

Edit:
To answer your first question:
No, i actually did not test to bump puppeteer to ^19.7.5.

I will try both cases and let you know how they worked.

@NicerDicerPro
Copy link
Author

So:

"puppeteer": "^19.7.5" (actually installed 19.8.0) + "puppeteer-chromium-resolver": "^19.2.0" did result in the exact same error as shown above.

"puppeteer-chromium-resolver": "^19.2.0" without an explicit puppeteer dependency also resulted in the same error.

Still somehow the PUPPETEER_SKIP_CHROMIUM_DOWNLOAD is ignored and PCR still tries to download puppeteer (which i explicitly told it not to).

@cenfun
Copy link
Owner

cenfun commented Mar 27, 2023

could you please upload the codes or create a repository for your cases? so I can reproduce this problem locally.

@cenfun
Copy link
Owner

cenfun commented Mar 27, 2023

btw, it would be better if the following information can be provided
which OS? Windows? Mac?
npm version?
nodejs version?

@NicerDicerPro
Copy link
Author

NicerDicerPro commented Mar 27, 2023

Im on a MacBook Pro M1, 2020.
macOS Ventura 13.2.1
node 18.12.1
npm 8.19.2

As per the code:
I cant share the exact build file/repo i use, because it underlays NDAs but i will see if i can isolate and reproduce the problem in a testcase i can provide for you.

@cenfun
Copy link
Owner

cenfun commented Mar 28, 2023

Sorry I cann't test on Mac OS, but test on Windows/WSL Linux Debian both are works.
and i found something from log you provided:

#14 176.8 [PCR] Chromium revision: 1095492
#14 176.8 [PCR] Not found local chromium
#14 176.8 [PCR] HEAD request: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1095492/chrome-linux.zip - true (343ms)
#14 176.8 [PCR] HEAD request: https://npmmirror.com/mirrors/chromium-browser-snapshots/Linux_x64/1095492/chrome-linux.zip - true (7627ms)
#14 176.8 [PCR] Downloading from: https://storage.googleapis.com ...

<= here should have error message if next download is another host, that means previous host failed download but nothing error or log output

#14 176.8 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 176.8 [PCR] Retry Chromium downloading ... 
#14 176.8 [PCR] Downloading from: https://storage.googleapis.com ...
#14 176.8 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 176.8 [PCR] Retry Chromium downloading ... 
#14 176.8 [PCR] Downloading from: https://storage.googleapis.com ...
#14 176.8 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 176.8 [PCR] Retry Chromium downloading ... 
#14 176.8 [PCR] Downloading from: https://storage.googleapis.com ...
#14 176.8 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 176.8 [PCR] ERROR: Failed to download Chromium after retry 3 times.

refer to source codes should be here:

let failed = false;
    const revisionInfo = await browserFetcher.download(options.revision, (downloadedBytes, totalBytes) => {
        Util.showProgress(downloadedBytes, totalBytes);
    }).catch((error) => {
        failed = true;
        Util.output(error, true);
    });

    if (failed || !revisionInfo) {
        return;
    }

the only problem should be API browserFetcher.download was nothing return, and this is a puppeteer API

const puppeteer = require('puppeteer-core');
createBrowserFetcher: (options) => {
        return new puppeteer.BrowserFetcher(options);
    },

There is a breaking change on this API BrowserFetcher before, see here puppeteer/puppeteer#8999
So could you please check your real installed version of puppeteer again
1, go to project root path
2, cd node_modules
3, cd puppeteer-core if exists puppeteer-core folder, open package.json and check version
4, cd puppeteer if exists puppeteer folder (should be wrong case) and check version in package.json too
or list how many puppeteer installed using following cli

npm list puppeteer-core
// or npm list puppeteer (wrong case)

thanks

@cenfun
Copy link
Owner

cenfun commented Mar 28, 2023

Found a new doubt is that the revision 1095492 you used is unnormal

#14 56.00 [PCR] Chromium revision: 1095492

the revision could be 1095492 if failed to get revision from puppeteer. It also proves that your Puppeteer is not installed normally

getPuppeteerChromiumRevision: () => {
        const revisions = puppeteer.PUPPETEER_REVISIONS;
        if (revisions) {
            return revisions.chromium;
        }
        return '1095492';
    },

just update 1095492 to 1108766 and publish a new version puppeteer-chromium-resolver@19.3.0
please have a try and see if works or more errors/logs expect, thanks

@NicerDicerPro
Copy link
Author

Installed versions (as of the package.json files in node_modules):
puppeteer: 19.18.0
puppeteer-chromium-resolver: 19.2.0
puppeteer-core: 19.8.0

Ill try updating to puppeteer-chromium-resolver 19.3.0 now.

@NicerDicerPro
Copy link
Author

NicerDicerPro commented Mar 28, 2023

After updating puppeteer-chromium-resolver to ^19.3.0 the installed versions (as of package.json files in node_modules) changed to:

puppeteer: 19.17.4
puppeteer-chromium-resolver: 19.3.0
puppeteer-core: 19.17.4

Both puppeteer and puppeteer-core downgraded from 19.8.0 to 19.17.4.

Anyways the error still persists

#14 68.16 [5/5] Building fresh packages...
#14 73.71 error /app/node_modules/puppeteer-chromium-resolver: Command failed.
#14 73.71 Exit code: 1
#14 73.71 Command: node ./lib/install.js
#14 73.71 Arguments: 
#14 73.71 Directory: /app/node_modules/puppeteer-chromium-resolver
#14 73.71 Output:
#14 73.71 [PCR] Chromium revision: 1108766
#14 73.71 [PCR] Puppeteer version: 19.8.0
#14 73.71 [PCR] Not found local chromium
#14 73.71 [PCR] HEAD request: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1108766/chrome-linux.zip - true (300ms)
#14 73.71 [PCR] HEAD request: https://npmmirror.com/mirrors/chromium-browser-snapshots/Linux_x64/1108766/chrome-linux.zip - false (4402ms)
#14 73.71 [PCR] Downloading from: https://storage.googleapis.com ...
#14 73.71 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 73.71 [PCR] Retry Chromium downloading ... 
#14 73.71 [PCR] Downloading from: https://storage.googleapis.com ...
#14 73.71 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 73.71 [PCR] Retry Chromium downloading ... 
#14 73.71 [PCR] Downloading from: https://storage.googleapis.com ...
#14 73.71 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 73.71 [PCR] Retry Chromium downloading ... 
#14 73.71 [PCR] Downloading from: https://storage.googleapis.com ...
#14 73.71 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 73.71 [PCR] ERROR: Failed to download Chromium after retry 3 times.
#14 73.71 /app/node_modules/puppeteer-chromium-resolver/lib/index.js:96
#14 73.71         executablePath: options.revisionInfo.executablePath
#14 73.71                                              ^
#14 73.71 
#14 73.71 TypeError: Cannot read properties of undefined (reading 'executablePath')
#14 73.71     at launchHandler (/app/node_modules/puppeteer-chromium-resolver/lib/index.js:96:46)
#14 73.71     at PCR (/app/node_modules/puppeteer-chromium-resolver/lib/index.js:235:15)
#14 73.71 
#14 73.71 Node.js v18.12.1
#14 73.71 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
executor failed running [/bin/sh -c yarn install --frozen-lockfile --network-timeout 100000]: exit code: 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Im wondering why the logfile tells #14 73.71 [PCR] Puppeteer version: 19.8.0 when the version installed via yarn install (and set in the yarn.lock file) is 19.17.4.

I'll try and create a isolated testcase to provide for you.

Still i dont understand why PCR tries to download chromium at all.
Im setting

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

in the docker build file so PCR should not download chromium at all (since i install it myself in the docker file so it works on AWS EC2 correctly).

Can you tell me why PCR tries to download chromium at all? Shouldnt this whole process be skipped by setting PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ?

@cenfun
Copy link
Owner

cenfun commented Mar 28, 2023

checked the latest version should be 19.8.0 https://www.npmjs.com/package/puppeteer-core?activeTab=versions
I don't understand why it can be installed to 19.17.4

@NicerDicerPro
Copy link
Author

NicerDicerPro commented Mar 28, 2023

Im currently working on an isolated test case i can provide so you can have a look yourself and maybe find whats the problem.

What would be the best approach to provide you with the case?
I could simply push the testcase into a public repo in my account, would that work for you?

@cenfun
Copy link
Owner

cenfun commented Mar 28, 2023

yes great, I need reproduce this problem locally.

@NicerDicerPro
Copy link
Author

NicerDicerPro commented Mar 28, 2023

Heres the testcase: https://github.com/NicerDicerPro/pcr-error-test

I just created an empty next.js project, added the puppeteer, puppeteer-element2selector and puppeteer-chromium-resolver dependencies as well as the dockerfile.

To build the docker worker you can just use yarn worker-build.
This should result in the error.

@cenfun
Copy link
Owner

cenfun commented Mar 28, 2023

just removed puppeteer, it's not required, could you please try again?
https://github.com/NicerDicerPro/pcr-error-test/pull/1/files

Note that you installed version is "19.7.4" not "19.17.4"(this version is impossible)

@NicerDicerPro
Copy link
Author

Yes you are correct, i misspelled, its 19.7.4.

I merged your pr, reinstalled the application and tried it again.
The error still occurs as beforehand:

#14 33.57 [5/5] Building fresh packages...
#14 38.49 error /app/node_modules/puppeteer-chromium-resolver: Command failed.
#14 38.49 Exit code: 1
#14 38.49 Command: node ./lib/install.js
#14 38.49 Arguments: 
#14 38.49 Directory: /app/node_modules/puppeteer-chromium-resolver
#14 38.49 Output:
#14 38.49 [PCR] Chromium revision: 1108766
#14 38.49 [PCR] Puppeteer version: 19.8.0
#14 38.49 [PCR] Not found local chromium
#14 38.49 [PCR] HEAD request: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1108766/chrome-linux.zip - true (313ms)
#14 38.49 [PCR] HEAD request: https://npmmirror.com/mirrors/chromium-browser-snapshots/Linux_x64/1108766/chrome-linux.zip - true (4203ms)
#14 38.49 [PCR] Downloading from: https://storage.googleapis.com ...
#14 38.49 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 38.49 [PCR] Retry Chromium downloading ... 
#14 38.49 [PCR] Downloading from: https://storage.googleapis.com ...
#14 38.49 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 38.49 [PCR] Retry Chromium downloading ... 
#14 38.49 [PCR] Downloading from: https://storage.googleapis.com ...
#14 38.49 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 38.49 [PCR] Retry Chromium downloading ... 
#14 38.49 [PCR] Downloading from: https://storage.googleapis.com ...
#14 38.49 [PCR] Downloading from: https://npmmirror.com/mirrors ...
#14 38.49 [PCR] ERROR: Failed to download Chromium after retry 3 times.
#14 38.49 /app/node_modules/puppeteer-chromium-resolver/lib/index.js:96
#14 38.49         executablePath: options.revisionInfo.executablePath
#14 38.49                                              ^
#14 38.49 
#14 38.49 TypeError: Cannot read properties of undefined (reading 'executablePath')
#14 38.49     at launchHandler (/app/node_modules/puppeteer-chromium-resolver/lib/index.js:96:46)
#14 38.49     at PCR (/app/node_modules/puppeteer-chromium-resolver/lib/index.js:235:15)
#14 38.49     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
#14 38.49 
#14 38.49 Node.js v18.12.1
#14 38.49 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
executor failed running [/bin/sh -c yarn install --frozen-lockfile --network-timeout 100000]: exit code: 1
error Command failed with exit code 1.

Is the docker worker build working for you when using my repo?

@cenfun
Copy link
Owner

cenfun commented Mar 28, 2023

Im tring to install docker to my local PC, need more time...

@NicerDicerPro
Copy link
Author

No problem, im not in a hurry, please take all the time you need 👍
If i can help you by providing anything else please let me know!

@cenfun
Copy link
Owner

cenfun commented Mar 28, 2023

doing yarn worker-build now

[+] Building 237.7s (12/23)
 => [internal] load build definition from Dockerfile                                                                                    0.1s s 
 => => transferring dockerfile: 1.68kB                                                                                                  0.0s0s  => [internal] load .dockerignore                                                                                                       0.0s s 
 => => transferring context: 2B                                                                                                         0.0s0s  => [internal] load metadata for docker.io/library/node:18.12.1-alpine                                                                  4.5s s 
 => [internal] load build context                                                                                                      26.2s3s  => => transferring context: 308.86MB                                                                                                  26.1s s 
 => [deps 1/6] FROM docker.io/library/node:18.12.1-alpine@sha256:a136ed7b0df71082cdb171f36d640ea3b392a5c70401c642326acee767b8c540      10.7s0s  => => resolve docker.io/library/node:18.12.1-alpine@sha256:a136ed7b0df71082cdb171f36d640ea3b392a5c70401c642326acee767b8c540            0.0s s 
 => => sha256:6d7b7852bcd3b24b35483caa22beb6d0955bbe8018a652b2e0ebc26fcdbcff3c 6.44kB / 6.44kB                                          0.0s4s  => => sha256:c158987b05517b6f2c5913f3acef1f2182a32345a304fe357e3ace5fadcad715 3.37MB / 3.37MB                                          1.9s s 
 => => sha256:aabd449b9131436e3664a0d3d1bc0e7b7c437baed49a2b9cd46c4131ad3358c3 46.59MB / 46.59MB                                        8.9s1s  => => sha256:756e97429a305b467d7427f9497892c554c9104de2e5b567fabd97a9b391d5b5 2.35MB / 2.35MB                                          2.4s s 
 => => sha256:a136ed7b0df71082cdb171f36d640ea3b392a5c70401c642326acee767b8c540 1.43kB / 1.43kB                                          0.0s0s  => => sha256:b375b98d1dcd56f5783efdd80a4d6ff5a0d6f3ce7921ec99c17851db6cba2a93 1.16kB / 1.16kB                                          0.0s s 
 => => extracting sha256:c158987b05517b6f2c5913f3acef1f2182a32345a304fe357e3ace5fadcad715                                               0.3s3s  => => sha256:1ee3f64a4fc80ad4dc011a3c1f11aa6277993b521ff57d029a3af874bda042f6 453B / 453B                                              3.0s s 
 => => extracting sha256:aabd449b9131436e3664a0d3d1bc0e7b7c437baed49a2b9cd46c4131ad3358c3                                               1.4s1s  => => extracting sha256:756e97429a305b467d7427f9497892c554c9104de2e5b567fabd97a9b391d5b5                                               0.1s s 
 => => extracting sha256:1ee3f64a4fc80ad4dc011a3c1f11aa6277993b521ff57d029a3af874bda042f6                                               0.0s s 
 => [builder 2/5] WORKDIR /app                                                                                                          0.3s5s  => [deps 2/6] RUN apk add --no-cache libc6-compat                                                                                    169.0s s 
 => [runner  3/11] RUN addgroup --system --gid 1001 nodejs                                                                              0.5s6 => [runner  4/11] RUN adduser --system --uid 1001 nextjs                                                                               0.6s s 
 => [builder 3/5] COPY . .                                                                                                              1.7s7s  => [deps 3/6] WORKDIR /app                                                                                                             0.0s s 
 => [deps 4/6] COPY package.json yarn.lock ./                                                                                           0.0s 
 => [deps 5/6] RUN apk --no-cache add chromium                                                                                         53.2s 
 => => # (18/145) Installing eudev-libs (3.2.11-r4)
 => => # (19/145) Installing pkgconf (1.9.4-r0)
 => => # (20/145) Installing libffi (3.4.4-r0)
 => => # (21/145) Installing libintl (0.21.1-r1)
 => => # (22/145) Installing libblkid (2.38.1-r1)
 => => # (23/145) Installing libmount (2.38.1-r1)

@cenfun
Copy link
Owner

cenfun commented Mar 28, 2023

seems that the docker build cannot be completed in my pc environment. it took a few hours to execute the run "RUN apk --no-cache add chromium" without any progress

=> CACHED [runner  2/11] WORKDIR /app                                                                                                       0.0s 
 => CACHED [runner  3/11] RUN addgroup --system --gid 1001 nodejs                                                                            0.0s 
 => CACHED [runner  4/11] RUN adduser --system --uid 1001 nextjs                                                                             0.0s 
 => CACHED [deps 2/6] RUN apk add --no-cache libc6-compat                                                                                    0.0s 
 => CACHED [deps 3/6] WORKDIR /app                                                                                                           0.0s 
 => CACHED [deps 4/6] COPY package.json yarn.lock ./                                                                                         0.0s 
 => CANCELED [deps 5/6] RUN apk --no-cache add chromium                                                                                   8513.4s 
 => CACHED [builder 3/5] COPY . .                                                                                                            0.0s

then I try to remove "RUN apk --no-cache add chromium" and build again

[+] Building 2950.7s (12/22)
 => [internal] load build definition from Dockerfile                                                                                         0.0s 
 => => transferring dockerfile: 1.44kB                                                                                                       0.0s 
 => [internal] load .dockerignore                                                                                                            0.0s 
 => => transferring context: 2B                                                                                                              0.0s 
 => [internal] load metadata for docker.io/library/node:18.12.1-alpine                                                                       1.6s 
 => [deps 1/5] FROM docker.io/library/node:18.12.1-alpine@sha256:a136ed7b0df71082cdb171f36d640ea3b392a5c70401c642326acee767b8c540            0.0s 
 => [internal] load build context                                                                                                            0.8s 
 => => transferring context: 1.18MB                                                                                                          0.7s 
 => CACHED [builder 2/5] WORKDIR /app                                                                                                        0.0s 
 => CACHED [runner  3/11] RUN addgroup --system --gid 1001 nodejs                                                                            0.0s 
 => CACHED [runner  4/11] RUN adduser --system --uid 1001 nextjs                                                                             0.0s 
 => CACHED [deps 2/5] RUN apk add --no-cache libc6-compat                                                                                    0.0s 
 => CACHED [deps 3/5] WORKDIR /app                                                                                                           0.0s 
 => CACHED [deps 4/5] COPY package.json yarn.lock ./                                                                                         0.0s 
 => [deps 5/5] RUN yarn install --frozen-lockfile --network-timeout 100000                                                                2948.2s 
 => => # [1/5] Validating package.json...
 => => # [2/5] Resolving packages...
 => => # [3/5] Fetching packages...
 => => # [4/5] Linking dependencies...
 => => # warning " > puppeteer-element2selector@0.0.3" has unmet peer dependency "puppeteer-core@>= 2.1.0".
 => => # [5/5] Building fresh packages...                                                                                                         
 => [builder 3/5] COPY . .      

still waiting for ...

@NicerDicerPro
Copy link
Author

Thats odd, an average build is running for like 30-60 seconds on my machine before it reaches the error.

@NicerDicerPro
Copy link
Author

Quick update from my end:
As part of a bigger process we will be dropping the docker worker from out project as whole.
So for our side this error will most likely disappear with the next release so im not sure how much time you want to keep investing into this issue.

If i can help you with any more information, please let me know!

@cenfun
Copy link
Owner

cenfun commented Mar 30, 2023

I have been testing the docker build in local but there is no new progress, probably because my local network env is very bad
and I am not good at docker releated tech, but I really want to find the root cause of this problem, do you have a server to allow me login/execute docker build on remote?

@NicerDicerPro
Copy link
Author

NicerDicerPro commented Mar 30, 2023

While we do have a AWS EC2 server which runs the docker container once its built, i cannot share credentials to that server (i actually don't even have the credentials).
Right now we built the image locally and upload it to that server for execution.

Im sorry i cant help you more here.

@cenfun
Copy link
Owner

cenfun commented Mar 30, 2023

could you please update new version puppeteer-chromium-resolver@19.3.1 and try again?
still not sure it's fixed
but i have test this docker file and it works: https://github.com/cenfun/puppeteer-chromium-resolver/blob/master/Dockerfile

@NicerDicerPro
Copy link
Author

NicerDicerPro commented Mar 31, 2023

I merged your PR.

The docker file provided by you works for me too.
But that docker file is very different than the one included in my testcase (which still ends in the same error).

Were still facing the same issue as from the beginning.
Im not actually sure what you're investigating and trying to fix.
In my opinion the error is not contained in the process of finding and downloading chromium because with my environment (see below) PCR should never start searching and/or downloading chromium:

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

The problem from the beginning still exists:
PCR ignores the PUPPETEER_SKIP_CHROMIUM_DOWNLOAD param and tries to download chromium still.

Anyways as said:
The issue is probably isolated to my specific case which we recently deleted from our project cause we got rid of the docker worker as whole.

I appreciate your effort in fixing my case but im afraid investigating this any further may be a big waste of time.

@cenfun
Copy link
Owner

cenfun commented Mar 31, 2023

thanks for the comments
just release a new version puppeteer-chromium-resolver@19.3.2
added env PUPPETEER_SKIP_DOWNLOAD to skip download when installation
(checked latest puppeteer the env name is PUPPETEER_SKIP_DOWNLOAD, not PUPPETEER_SKIP_CHROMIUM_DOWNLOAD)
please have a try, thanks

@NicerDicerPro
Copy link
Author

Oh well, maybe the problem then is simply the renaming of the env variable!

Ill check and get back to you.

@NicerDicerPro
Copy link
Author

With updating to puppeteer-chromium-resolver to 19.3.2 and renaming the env var to PUPPETEER_SKIP_DOWNLOAD everything works fine:

[+] Building 90.7s (22/22) FINISHED                                                                                                                                                                
 => [internal] load build definition from Dockerfile                                                                                                                                          0.0s
 => => transferring dockerfile: 1.61kB                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                             0.0s
 => => transferring context: 2B                                                                                                                                                               0.0s
 => [internal] load metadata for docker.io/library/node:18.12.1-alpine                                                                                                                        0.0s
 => [internal] load build context                                                                                                                                                             0.8s
 => => transferring context: 1.38MB                                                                                                                                                           0.6s
 => [deps 1/6] FROM docker.io/library/node:18.12.1-alpine                                                                                                                                     0.0s
 => CACHED [builder 2/5] WORKDIR /app                                                                                                                                                         0.0s
 => [runner 3/9] RUN addgroup --system --gid 1001 nodejs                                                                                                                                      0.2s
 => [runner 4/9] RUN adduser --system --uid 1001 nextjs                                                                                                                                       0.3s
 => CACHED [deps 2/6] RUN apk add --no-cache libc6-compat                                                                                                                                     0.0s
 => CACHED [deps 3/6] WORKDIR /app                                                                                                                                                            0.0s
 => [deps 4/6] COPY package.json yarn.lock ./                                                                                                                                                 0.0s
 => [builder 3/5] COPY . .                                                                                                                                                                    2.5s
 => [deps 5/6] RUN apk --no-cache add chromium                                                                                                                                               17.6s
 => [deps 6/6] RUN yarn install --frozen-lockfile --network-timeout 100000                                                                                                                   30.8s
 => [builder 4/5] COPY --from=deps /app/node_modules ./node_modules                                                                                                                           1.7s 
 => [builder 5/5] RUN yarn build                                                                                                                                                             17.7s 
 => [runner 5/9] COPY --from=builder /app/next.config.js ./                                                                                                                                   0.0s 
 => [runner 6/9] COPY --from=builder /app/public ./public                                                                                                                                     0.0s 
 => [runner 7/9] COPY --from=builder /app/package.json ./package.json                                                                                                                         0.0s 
 => [runner 8/9] RUN apk --no-cache add curl                                                                                                                                                  1.4s 
 => [runner 9/9] RUN apk --no-cache add chromium                                                                                                                                             18.5s 
 => exporting to image                                                                                                                                                                        0.9s 
 => => exporting layers                                                                                                                                                                       0.9s 
 => => writing image sha256:461426c4e1d44018a0952a62f1e3082502754cb9b876801ddb78c08339dfac0e                                                                                                  0.0s 
 => => naming to docker.io/library/pcr-error-test-worker                                                                                                                                      0.0s 
 => => naming to docker.io/library/pcr-error-test-worker:0.0.1                                                                                                                                0.0s 
                                                                                                                                                                                                   
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
✨  Done in 99.52s.

Thank you for your help and effort fixing this issue 🚀

I'll close this issue with this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants