We have configured Chromium to open PDF on AWS beanstalk. It was working perfectly fine until recently. Here is the new error that appears:
{"statusCode":400,"message":"Failed to launch the browser process!\n/var/app/current/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n","error":"Bad Request"}
I dont know if it is related to the Beanstalk Linux configuration.
In order to have chrome pupeteer work previously, we used this configuration :
.ebextensions/chrome_pupeteer.config:
packages:
yum:
compat-libtiff3: []
commands:
chrome:
command: curl -k https://intoli.com/install-google-chrome.sh | bash
and in .npmrc :
unsafe-perm=true
Can you please help me find another solution ?
Thank you
I tried to install with yum command the package: libatk-1.0.so.0
It did not work:
2023-06-08 11:16:16,116 P7952 [INFO] Command install 2023-06-08 11:16:18,226 P7952 [INFO] -----------------------Command Output----------------------- 2023-06-08 11:16:18,226 P7952 [INFO] Loaded plugins: extras_suggestions, langpacks, priorities, update-motd 2023-06-08 11:16:18,226 P7952 [INFO] No package libatk1.0-0 available. 2023-06-08 11:16:18,226 P7952 [INFO] Error: Nothing to do 2023-06-08 11:16:18,226 P7952 [INFO] ------------------------------------------------------------ 2023-06-08 11:16:18,227 P7952 [ERROR] Exited with error code 1
I had the same issue, but using PuppeteerSharp with .net core 6.0. I was using the same intoli install-google-chrome script in .ebextensions that you are. Here is how I fixed it. Change your chrome_puppeteer.config to
commands:
chrome:
command: sudo amazon-linux-extras install epel -y && sudo yum install -y chromium
Then, if you are setting the PUPPETEER_EXECUTABLE_PATH as an environment variable in your code, change it to:
/usr/bin/chromium-browser
Lastly, if you are using the Puppeteer BrowserFetcher
's DownloadAsync
method, you don't have to.
It seemed like the intoli installed version of Chrome was missing a new dependency (or more). After some research I found that installing AWS EPEL (Extra Packages for Enterprise Linux) and then Chromium ensured all the dependencies existed and behaved well with AWS instances. The above should work for EC2 instances as well.