

Specifies wether it allows downloading multiple files or notĪwait page. My question is, is there a way to wait for a download to complete using Node+Puppeteer? I have tried using waitUntil: 'networkidle0 and networkidle2 but both seem to wait forever.Ĭode below: const path = require('path') Ĭonst browser = await puppeteer.launch() However, this 50 MB limit doesn’t apply when you load the function from S3! See the documentation here.I have a script made using node.js and puppeteer which downloads a file from a button (which doesn't redirect to a url), so right now i'm using await await page.waitForTimeout(1000) to wait for the download to complete but it has a few flaws, such as:ĭepending on the connection, the download might take more than 1000ms to finish, as well as it might take less, which wouldn't make sense to wait more than what took to finish the download.

Due to the fact that it installs Chromium, the Puppeteer package is significantly larger than that. Problem #1 – Puppeteer is too big to push to LambdaĪWS Lambda has a 50 MB limit on the zip file you push directly to it. You only need to pay for what you use, and they also have a generous free trial. Getting started with AWS Lambda is simple and inexpensive.

All of my back-end API routes are hosted on AWS Lambda when users sign up for my services. I also manage to insert data into databases. Puppeteer runs headless by default, but can be configured to run full (non-headless) Chrome or Chromium. For example, I scrape thousands of public web pages every night with AWS Lambda functions. Puppeteer is a library which provides a high-level API to control Chrome, Chromium, or Firefox Nightly over the DevTools Protocol. Okay, everything is a strong word, but almost. The browser is downloaded to the HOME/.cache/puppeteer folder by default (starting with Puppeteer v19.0.0). Simply put, you can do everything on AWS Lambda. When you install Puppeteer, it automatically downloads a recent version of Chrome for Testing (170MB macOS, 282MB Linux, 280MB Windows) that is guaranteed to work with Puppeteer. AWS Lambda is what Amazon calls “Run code without thinking about servers or clusters.” You can simply create a function on Lambda and then execute it.
