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

page.goto: net:: ERR_INSUFFICIENT_RESOURCES with playwright and @sparticuz/chromium in AWS Lambda #275

Open
PrinceT078 opened this issue May 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@PrinceT078
Copy link

I am scraping a website using playwright with @sparticuz/chromium in AWS Lambda. It sometimes throws below error on page.goto():
page.goto: net:: ERR_INSUFFICIENT_RESOURCES

Code structure:

An API call is made that scrapes data from a website. Since scraping might fail due to various reasons, I have added 2 times retry in code. So when an error occurs a new context will be created from existing browser instance and scraping will start again. In the end we iterate over opened contexts and close them and then close the browser.
In case the code fails even after retrying 2 times internally, we send back error.
ERR_INSUFFICIENT_RESOURCES error scenario:

After giving back error as mentioned above, an API call is made again for scraping again, it starts giving ERR_INSUFFICIENT_RESOURCES error continuously from this point.
Tries keeping Lambda Memory and Ephemeral Storage to 10000 MB and still the error persists.

@PrinceT078 PrinceT078 added the bug Something isn't working label May 21, 2024
@grakic
Copy link

grakic commented Oct 29, 2024

Please ensure the browser instance is fully closed before returning the Lambda error response.

It seems the ERR_INSUFFICIENT_RESOURCES error relates to browser resources persisting between Lambda invocations, when environment is frozen during browser shutdown and reused for the next invocation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants