Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] AWS Lambda Function #55

Open
ariel-frischer opened this issue Feb 26, 2021 · 1 comment
Open

[FEATURE REQUEST] AWS Lambda Function #55

ariel-frischer opened this issue Feb 26, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@ariel-frischer
Copy link

Great library I'm just wondering if anyone has managed to deploy this as an AWS lambda function (with or without a lambda layer). It seems the puppeteer module is quite large which makes things a bit more difficult. If you can share a bit of insight on how to accomplish this I would be grateful.

@ariel-frischer ariel-frischer added the enhancement New feature or request label Feb 26, 2021
@ariel-frischer ariel-frischer changed the title [FEATURE REQUEST] [FEATURE REQUEST] AWS Lambda Function Feb 26, 2021
@tungs
Copy link
Owner

tungs commented Feb 26, 2021

Though I don't have a lot of experience with this, some people, like andreastepel, have been trying this out with timecut— see tungs/timecut#44.

Long story short, there's a new version of timesnap that doesn't bundle the puppeteer dependency called timesnap-core. You can combine this with a smaller puppeteer package meant for AWS Lambda like chrome-aws-lambda.

The code would look something like this:

const timesnap = require('timesnap-core');
const chromium = require('chrome-aws-lambda');

exports.handler = async (event, context, callback) => {
  await timesnap({
    browser: chromium.puppeteer.launch({
      args: chromium.args,
      //... the rest of the arguments found in https://github.com/alixaxel/chrome-aws-lambda/blob/master/README.md
    }),
    url: event.url,
    outputDirectory: '/tmp'
    // ...
  });
  //
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants