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
"Protocol error (Target.createTarget)" when running puppeteer inside AWS lambda container #6776
Comments
I'm having the same issue (except with Alpine and not Amazon Linux), and I'd also reported this issue in the Chromium issue tracker — see https://bugs.chromium.org/p/chromium/issues/detail?id=1143503#c8 In the interest of adding more context, I'm including that issue here as well —
Some observations —
|
Maybe |
Interesting; although from the logs, what I see is that a browser instance is launched; it crashes soon after that because of the lack of a GPU. From the logs —
|
@paambaati the puppeteer runs with the flag |
@markb-trustifi Thanks, I’m aware (see quoted report from the Chromium issue tracker), and hence the report. The presence of that flag seems to have no effect when running puppeteer on the AWS Lambda container environment. |
@mathiasbynens Would you mind taking a look? I see you’re tagged in the related issue in the Chromium bug tracker too. |
FYI similar issue: #1947 |
Same issue with Puppeteer 8 in a Docker container The test code is the example below. It fails on const page = await browser.newPage(); line
Traceback:
|
I don't have any chance to try it on intel but I'm facing this exact same issue with puppeteer 5.4.1 on apple silicon. Did you sort this out? Thanks :) |
Still getting the same error running Puppeteer on Apple Silicon. |
Getting the same exact issue with my lambda container function.
by the way, when I run locally using Lambda Runtime Interface Emulator everything works smoothly. |
@markb-trustifi @jackHedaya have you been able to get puppeteer running in Docker on M1 Silicon? is #7546 related? |
Is there any solution or recommended workaround? |
|
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
Unfortunetely, it is an active issue. Have the same issue with was lambda and nodejs runtime. It is not reproducible on local, but easy to reproduce deploying it to lambda. |
I meet the same problem on AWS lambda, and the flag const browser = await puppeteer.launch({
headless: true,
args: ['--use-gl=egl', '--no-sandbox', '--single-process'],
}); Not sure if it helps in your case. |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
Unfortunately, we won't be able to troubleshoot the issues involving AWS Lambda. Could someone provide the CDP logs and dubmpio logs from AWS Lambda using the latest Puppeteer version? Also please try the official Docker image and see if it works: https://github.com/puppeteer/puppeteer/blob/main/docker/Dockerfile (it requires --cap-add=SYS_ADMIN so I am not sure if it will run on AWS Lambda). With that info, I think we should report the issue to crbug.com again because https://crbug.com/143503 looks like a different issue. |
Worked like a charm! Thanks a lot - life saviour after many days banging my head against the wall |
Same issue with Alpine running in AWS Fargate. Only --single-process fixes it. This problem doesn't happen on EC2, Cloud9, or even containers built and run on Apple M1. I'm using Node 20 with Puppeteer version 21 but also saw it on all versions of Puppeteer 20. Dockerfile and package.json are here. |
Yep facing the same issue on Fargate, just deployed with |
Facing this on Google Cloud functions using Puppeteer v21.6.0 |
Having same issue when trying to just open a login page from Microsoft (ex: https://login.microsoftonline.com) when the page check if user logged in or not before too present the form. |
AWS Lambda environment is limited and I believe the regular browser misses system dependencies that it needs there. Consider trying out the stripped down Chromium builds for AWS Lambda and also see tips for running in the serverless envs https://github.com/Sparticuz/chromium If you see a targetCrashed event in the logs like in this repo, make sure the server environment has all dependencies Chrome needs https://pptr.dev/troubleshooting#chrome-doesnt-launch-on-linux |
Steps to reproduce
What steps will reproduce the problem?
Build docker container and deploy it to the AWS Lambda.
The following dockerfile runs well in a local docker container and doesn't run in AWS Lambda env.
The code also runs in an EC2 t2.micro env.
What is the expected result?
Pass all tests:
What happens instead?
The puppeteer passes the launch and fails at the creation of a new empty page, despite that the
ldd $PUPPETEER_EXECUTABLE_PATH
finds all libraries.ERROR: Protocol error (Target.createTarget): Target closed.\n at /var/task/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:71:63\n at new Promise (<anonymous>)\n at Connection.send (/var/task/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:70:16)\n at Browser._createPageInContext (/var/task/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:221:53)\n at BrowserContext.newPage (/var/task/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:500:30)\n at Browser.newPage (/var/task/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:214:37)\n at ...', message: 'Protocol error (Target.createTarget): Target closed.'
The text was updated successfully, but these errors were encountered: