Skip to content

Commit

Permalink
docs(troubleshooting): describe EC2 Amazon-Linux setup (#6771)
Browse files Browse the repository at this point in the history
Co-authored-by: Mathias Bynens <mathias@qiwi.be>
  • Loading branch information
aravind666 and mathiasbynens committed Jan 22, 2021
1 parent 5ea76e9 commit 26fa363
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/troubleshooting.md
Expand Up @@ -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 -->

Expand Down Expand Up @@ -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`.
Expand Down

0 comments on commit 26fa363

Please sign in to comment.