docs(troubleshooting): describe EC2 Amazon-Linux setup (#6771)

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
This commit is contained in:
Aravind.H.U 2021-01-22 13:55:35 +05:30 committed by Mathias Bynens
parent 5ea76e9333
commit 26fa363443

View File

@ -17,6 +17,7 @@
* [Running Puppeteer on Google Cloud Functions](#running-puppeteer-on-google-cloud-functions)
* [Running Puppeteer on Heroku](#running-puppeteer-on-heroku)
* [Running Puppeteer on AWS Lambda](#running-puppeteer-on-aws-lambda)
* [Running Puppeteer on AWS EC2 instance running Amazon-Linux](#running-puppeteer-on-aws-ec2-instance-running-amazon-linux)
- [Code Transpilation Issues](#code-transpilation-issues)
<!-- GEN:stop -->
@ -415,6 +416,24 @@ AWS Lambda [limits](https://docs.aws.amazon.com/lambda/latest/dg/limits.html) de
- https://github.com/alixaxel/chrome-aws-lambda (kept updated with the latest stable release of puppeteer)
- https://github.com/adieuadieu/serverless-chrome/blob/master/docs/chrome.md (serverless plugin - outdated)
### Running Puppeteer on AWS EC2 instance running Amazon-Linux
If you are using an EC2 instance running amazon-linux in your CI/CD pipeline, and if you want to run Puppeteer tests in amazon-linux, follow these steps.
1. To install Chromium, you have to first enable `amazon-linux-extras` which comes as part of [EPEL (Extra Packages for Enterprise Linux)](https://aws.amazon.com/premiumsupport/knowledge-center/ec2-enable-epel/):
```sh
sudo amazon-linux-extras install epel -y
```
1. Next, install Chromium:
```sh
sudo yum install -y chromium
```
Now Puppeteer can launch Chromium to run your tests. If you do not enable EPEL and if you continue installing chromium as part of `npm install`, Puppeteer cannot launch Chromium due to unavailablity of `libatk-1.0.so.0` and many more packages.
## Code Transpilation Issues
If you are using a JavaScript transpiler like babel or TypeScript, calling `evaluate()` with an async function might not work. This is because while `puppeteer` uses `Function.prototype.toString()` to serialize functions while transpilers could be changing the output code in such a way it's incompatible with `puppeteer`.