Redirecting Puppeteer screenshot to S3


I’m trying to do something similar to what this person did but I’m having difficulty figuring out how to redirect the output of Puppeteer screenshotting directly to S3 as the screenshot function only has a parameter for local directory paths. Storing the images on Lambda is an option but not a preferred one.


Passing a path to screenshot is optional. You can omit the path and use the Promise<[Buffer|String]>> it returns as the content for a new S3 object (after awaiting it). Assuming you have the AWS SDK and a bucket set up already, your configuration will look something like this:

Then, wherever you’re ready to take the screenshot:

Depending on what you intend to use it for, you may want to add ContentType or other relevant headers to the parameters. You can see the list in the documentation.

Leave a Reply