amarinediary / Puppeteer-AWS-Elastic-Beanstalk-Deployment-Hotfix

Puppeteer deployment folder for AWS Elastic Beanstalk (64bit Linux 2 Node.js 14 environment) using AWS/GitHub Code Pipeline (Optional).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Puppeteer AWS Elastic Beanstalk Deployment Hotfix

Puppeteer deployment folder for AWS Elastic Beanstalk (64bit Linux 2 Node.js 14 environment) using AWS/GitHub Code Pipeline (Optional).

Related to Puppeteer troubleshooting documentation, Running Puppeteer on AWS EC2 instance running Amazon-Linux and Chrome is downloaded but fails to launch on Node.js 14 issues.

Table of contents

Elastic Beanstalk environement

- Parameters
Platform Node.js
Platform branch Node.js 14 running on 64bit Amazon Linux 2
Tested up to platform version 5.4.8 (Recommended)

Backward compatibility

This deployment folder has been successfully tested with AWS Elastic Beanstalk on a Node.js 12 running on 64bit Amazon Linux 2 environement.

Quick start

Clone this repository, and use it as your deployement folder:

  1. git clone https://github.com/amarinediary/Puppeteer-AWS-Elastic-Beanstalk-Deployment-Hotfix.git

Initiate your new project and install dependencies:

  1. npm init --y
  2. npm i puppeteer --save

.npmrc file

The .npmrc file defines how npm should behave when running commands. Setting unsafe-perm to true suppress the UID/GID switching when running package scripts. Set the unsafe-perm flag to run scripts with root privileges.

.ebextensions folder

You can add AWS Elastic Beanstalk configuration files (.ebextensions) to your web application's source code to configure your environment and customize the AWS resources that it contains.

In our case, if we don't enable EPEL (Extra Packages for Enterprise Linux) and if we continue installing chromium as part of npm package install, Puppeteer cannot launch Chromium due to the unavailability of libatk-1.0.so.0.

Deployment folder structure

app/
├── .ebextensions/
│   ├── 01_enableEPEL.config
│   └── 02_installEPELPackages.config
├── .npmrc
...

Dumb mistakes

If your deployment isn't working you should always try to look at the log file from your Elastic Beanstalk environment. A common mistake is packages mismatch between your local environment and your Elastic Beanstalk environment. Make sure both environment match.

A few related GitHub Puppeteer tickets threads

Watch it, Star it, Fork it

We made your day? Give us a star!

About

Puppeteer deployment folder for AWS Elastic Beanstalk (64bit Linux 2 Node.js 14 environment) using AWS/GitHub Code Pipeline (Optional).