Articles on: Technical support

Using more units than expected

You might be using too many units because you're not closing the browser after you're done using it, and reaching the default 15-minute global timeout (consuming 30 units per browser).

The quickest fix is to set the max timeout you expect your browser to run by modifying the timeout flag, this will ensure your browsers closes once this timeout is reached e.g. if your sessions take less than 10 seconds, you can set the timeout to 30000 (30 seconds in milliseconds) and it'll ensure you never use more than 1 unit per request.

The best practice is to handle exceptions and close the browser every time. You might have the browser.close() in your code, but when an unexpected error or timeout occurs, it won't reach that line of code, causing your connection to the browser to disconnect but the browser stays alive, consuming units. The suggestion is to use try/catch blocks to catch these unhandled errors and ensure the browser is always closed, read 7 tips to making your puppeteer scripts more bulletproof.

Updated on: 05/09/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!