alixaxel / chrome-aws-lambda

Chromium Binary for AWS Lambda and Google Cloud Functions
MIT License
3.17k stars 289 forks source link

Protocol error (Input.dispatchMouseEvent): Target closed? #260

Open avikha opened 2 years ago

avikha commented 2 years ago

Environment

Expected Behavior

Should work properly.

Current Behavior

When running inside the lambda, in headless mode, we are seeing errors like these:

Error: Protocol error (Input.dispatchMouseEvent): Target closed.
   at /tmp/wdio/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:217:63
   at new Promise (<anonymous>)
   at CDPSession.send (/tmp/wdio/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:216:16)
   at Mouse.move (/tmp/wdio/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js:343:32)
   at Mouse.click (/tmp/wdio/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js:367:24)
   at ElementHandle.click (/tmp/wdio/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js:416:32)
  at processTicksAndRejections (internal/process/task_queues.js:95:5)

We have a hard time understanding what is not working as expected and what happens. Mostly, we see these errors after navigation operation, but not only.

Not only with the mouse event, but other things as well, they all end eventually with 'Target closed'.

We guess that the chrome/chromium crashes inside the lambda, but we are having a very hard time understanding why and when.

We are running our tests with webdriover.io, using the CDP/Puppeteer protocol and using the chrome-aws-lambda.

Steps to Reproduce

Hard to explain. Running puppeteer in a lambda with some consuming/not-simple-websites (like web builders, photoshop, or sites that have animations), or sometimes even having many navigations inside single tests and running it hundreds of times a day.

It is not only getting crashed, but it is also getting the lambda stuck.

Possible Solution

Hard to say. We would like to hear ideas, perhaps someone already seen and solved/worked around the problem.

Thanks, everyone.

01231 commented 2 years ago

I also have this issue. Everything worked properly. But since yesterday I run into this problem.

shelltr commented 2 years ago

I've never gotten this version to work properly for my use case. Have you tried either downgrading to 9.x or upgrading to 12.x?

https://github.com/alixaxel/chrome-aws-lambda/issues/255