puppeteer: [Bug]: Not working with Amazon Linux 2023/6.0.3
Minimal, reproducible example
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setContent("<p>Hello world!</p>");
// const pageHeight = await page.evaluate(() => {
// return window.innerHeight;
// });
// const millimeters = pageHeight * (25.4 / 96);
const buffer = await page.pdf({
format: "A4",
printBackground: true,
margin: {
left: "0px",
top: "0px",
right: "0px",
bottom: "0px",
},
});
await browser.close();
})();
Error string
Failed to launch the browser process!\n/home/webapp/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: /home/webapp/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: cannot execute binary file\n\n\nTROUBLESHOOTING: https://pptr.dev/troubleshooting\n
Bug behavior
- Flaky
Background
No response
Expectation
The expectation was to generate the buffer of a PDF.
Reality
I actually receive the error:
Failed to launch the browser process!\n/home/webapp/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: /home/webapp/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome: cannot execute binary file\n\n\nTROUBLESHOOTING: https://pptr.dev/troubleshooting\n
Puppeteer configuration file (if used)
No response
Puppeteer version
21.7.0
Node version
18.19.0
Package manager
npm
Package manager version
10.2.3
Operating system
Linux
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Comments: 15
For others who stumble upon this (for
x64
):I am currently using “puppeteer”: “^22.4.1” and AMI
amazon/aws-elasticbeanstalk-amzn-2023.3.20240219.64bit-eb_nodejs20_amazon_linux_2023-hvm-2024-02-20T16-40
, and the solution for me was this.ebextensions
configuration file:I also needed to install some fonts for my use case, which rendered the additional packages in my
.ebextensions
configuration file:Even though the question is about
arm64
and notx64
, I believe others may find this helpful.@raphaelsetin you are my hero.
For those using regular Amazon Linux 2023:
sudo yum install libXcomposite libXdamage libXrandr libxkbcommon pango alsa-lib atk at-spi2-atk cups-libs libdrm mesa-libgbm
Chrome needs these dependencies https://pptr.dev/troubleshooting#chrome-doesnt-launch-on-linux If you have browser builds provided by Amazon Linux you can use those (if the version is compatible) and provide the path to the browser binary using the executablePath launch option.