esbenp / pdf-bot

🤖 A Node queue API for generating PDFs using headless Chrome. Comes with a CLI, S3 storage and webhooks for notifying subscribers about generated PDFs
MIT License
2.63k stars 142 forks source link

Lambda function #3

Closed etiennea closed 7 years ago

etiennea commented 7 years ago

Could we have an example of a lambda function for this?

JasonShin commented 7 years ago

You can easily build an equivalent Lambda function on your own. It took me like 20 lines to code it last time.

esbenp commented 7 years ago

I am sorry I am not familiar with Lambda functions. If you write on feel free to submit it though so it can be included as an example :-)

JasonShin commented 7 years ago

Sure, I can try doing that over the weekend =)...

esbenp commented 7 years ago

Sounds good!

mattcodez commented 7 years ago

@JasonShin Did you look into this at all by chance? I'm curious what your thoughts are for implementing this on Lambda, would you just leave a Chrome instance running on an EC2 box? What all would the Lambda portion be responsible for?

JasonShin commented 7 years ago

Sorry, guys haha... totally forgot about this ... I wouldn't worry about "bot" aspect of this application at all because you would probably want to use Lambda as a stateless function as a service. I would probably just grab https://github.com/esbenp/pdf-bot/blob/master/src/pdfGenerator.js and turn it into a Lambda function (ideally use Serverless Framework). Another approach would run the "bot" aspect of this app on a separate server and modify it to invoke the Lambda function to generate the PDFs. I will remind myself on Google Calendar to have a look into this weekend.