Configuring Puppeteer

πŸ“Requirements

  • RAM: 512 MB (recommended for basic tasks)

    • The ideal amount of RAM may vary depending on the specifics of each case.

πŸ“¦Add Puppeteer to APT of discloud.config

In the APT line, add the puppeteer package separated by comma and space after the already existing packages, as in the example below.

discloud.config
...
APT=tools, puppeteer
...

βš™οΈConfiguring the Puppeteer

To ensure proper functioning of Puppeteer in a container, it is necessary to add the --no-sandbox argument in the puppeteer.launch(); statement, as shown in the following example:

const browser = await puppeteer.launch({
  args: ['--no-sandbox']
});

βš™οΈConfiguration of dependencies that use Puppeteer

As whatsapp-web.js uses Puppeteer (for QR code generation and background interactions), it is necessary to add the --no-sandbox argument to the Puppeteer options, as in the following example:

const client = new Client({
	puppeteer: {
		args: ['--no-sandbox'],
	}
});

In case of insufficient RAM memory, the QR code may not appear in the Discloud logs. To solve this, increase the memory of your app as mentioned in the requirements above, so that Puppeteer works as expected.

Last updated