-
-
Notifications
You must be signed in to change notification settings - Fork 297
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
Can't run Puppeteer in AWS Lambda. #294
Comments
@dev1ninja I am also facing the same issue. |
@pandeysoni I am still facing the same issue. |
I am having the same issue
|
Looks like there may be an issue in the examples in the readme, I'm guessing it should be await Chromium.executablePath() |
Heyy, it seems that is not it :( What worked for me was downgrading my lambda to Node14.x and use this lambda layer: https://github.com/shelfio/chrome-aws-lambda-layer hope it helps! |
I switched to this and so far it's running (Node 18) on Lambda without any issue. |
chrome-aws-lambda is not working on node 16 and node 18, it is an existing issue. |
I finally managed to make it worked and described the solution here, hope it's helpful: https://konarskis.substack.com/p/puppeteer-aws-lambda The key was to match the versions of puppeteer and chromium, and download the chromium binary at runtime as opposed to trying to put it inside the Lambda itself. This way, we don't need any layers, external dependencies, or other configuration changes. |
This works for me as well on node 18 |
Thanks for taking the time to write this up @konarskis, was very helpful! |
I came across many articles on getting Puppeteer to work with Lambda; however, most of them relied on hacks, older versions, or third-party libraries. Wanting to keep my implementation as close to native libraries as possible, I opted to containerize my Lambda function. Almost all of these things are documented in official docs of respective libraries. Project using Typescript
Build command
Dockerfile
Build image and run the container:
The docker image is working fine locally. I am still yet to deploy this in Lambda, if someone wants it, I can share that info too. |
It worked ? Just tried something similar and chrome fails to start in lambda. |
@kbourro Partly. The containerized approach works in headless mode, but my requests were blocked by the site's CAPTCHA. I concluded that using residential proxies + Lambda or paid scraper services would solve this. In the end, I decided to host it on my local machine for my use case. It wasn't worth the time for my use case. |
I got this error when I run my scripts that use Puppeteer in Node.js.
Here is my script.
How can I solve this problem?
The text was updated successfully, but these errors were encountered: