Chromium stopped working in Alpine Docker Gitlab
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.11.0
- Platform / OS version: Alpine Linux v3.8 within Docker (
node:alpine
) GitLab CI - URLs (if applicable): -
- Node.js version: 11.6.0
What steps will reproduce the problem?
Please include code that reproduces the issue.
npm install puppeteer
npm test
What is the expected result?
the tests are running within headless chromium
What happens instead?
The following error occurs:
(95/95) Installing chromium@edge (71.0.3578.98-r2)
[...]
(node:104) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
(node:104) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:104) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[...]
Chromium revision is not downloaded. Run "npm install" or "yarn install"
at Launcher.launch (node_modules/puppeteer/lib/Launcher.js:115:15)
Notes
After puppeteer refused to work with the bundled chromium (ENOENT
error),
as suggested in https://github.com/GoogleChrome/puppeteer/issues/379#issuecomment-437688436, thread linked from the main official troubleshooting documentation, I’ve decided to use the system-installed chromium with the following configuration snippet:
// gitlab-ci:yaml
image: node:alpine
variables:
IS_CI: "true"
[...]
test:
stage: test
script:
- echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && apk add --no-cache chromium@edge nss@edge harfbuzz@edge
- npm test
dependencies:
- prepare
artifacts:
paths:
- coverage
only:
- branches
- tags
variables:
CHROME_BIN: '/usr/bin/chromium-browser'
// package.json
{
"devDependencies": {
"jest": "^23.6.0",
"jest-puppeteer": "3.7.0",
"puppeteer": "^1.11.0"
}
}
// jest-puppeteer.config.js
const defaultConfig = {
launch: {
args: ['--no-sandbox']
}
};
if (process.env.IS_CI) {
defaultConfig.launch.executablePath = '/usr/bin/chromium-browser';
defaultConfig.launch.args = ['--disable-dev-shm-usage'];
}
module.exports = defaultConfig;
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Chromium stopped working in Alpine Docker Gitlab #3740
I think the latest addendum to the troubleshooting regarding Alpine helped me getting puppeteer working (I mean, it does run puppeteer, the fact ......
Read more >alpine (docker@latest) chromium fails to start. (#8197) · Issues
I cannot run chromium latest (61) on alpine 3.6 (using docker:latest). I suspect there is some bug / missing depdency.
Read more >Docker (node:8.15-alpine) + Chromium + Karma unit tests not ...
I'm trying to run my frontend tests on Docker (node:8.15-alpine) using Chromium and Karma, however I'm getting lots of ChromeHeadless related ...
Read more >Troubleshooting - Puppeteer
Make sure all the necessary dependencies are installed. You can run ldd chrome | grep not on a Linux machine to check which...
Read more >Puppeteer in alpine docker with chromium headless dosent ...
But sadly nothing worked. Can I have a fix or better way for doing it? Chromium version - 93.0.4577.82, Firefox version - 94.0,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
These are the relevant parts of my Dockerfile. Not quite sure how to get around this error?
I add
--cap-add=SYS_ADMIN
indocker run
can solve this problem