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

Puppeteer 12.0.x #248

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Puppeteer 12.0.x #248

wants to merge 6 commits into from

Conversation

alixaxel
Copy link
Owner

@alixaxel alixaxel commented Dec 5, 2021

No description provided.

@mkubenka
Copy link

mkubenka commented Dec 7, 2021

This fix many issues with crashing Chromium, for example:

[1206/231121.285380:FATAL:render_frame_impl.cc(2196)] Check failed: !in_frame_tree_.
....

Thanks! 🎉 🙇

@Sparticuz
Copy link

Is there something blocking this @alixaxel?

@bmacher
Copy link

bmacher commented Dec 18, 2021

Yes, would be cool, if I could start the new year with a fresh version of this package. 😅

I need waitForNetworkIdle(), because I am using waitForTimeout() currently, which is not recommended.

Merry Christmas 🎁

@mkubenka
Copy link

mkubenka commented Jan 4, 2022

You can use this PR as a dependency:

npm i alixaxel/chrome-aws-lambda#puppeteer@12

@Sparticuz
Copy link

@alixaxel Upstream is now on 13.x https://github.com/puppeteer/puppeteer/releases/tag/v13.0.1

@turakvlad
Copy link

Is there any way we can update this PR with 13.x and merge it?

@osmoossi
Copy link

Could we get this merged? Getting a lot of "Target closed" errors in Lambda. The fix (puppeteer/puppeteer#7728) is included in puppeteer >11.0, so really looking forward to this.

@Sparticuz
Copy link

You can use this PR as a dependency:

npm i alixaxel/chrome-aws-lambda#puppeteer@12

Installing the branch does not work for me.

@KevinVR
Copy link

KevinVR commented Jan 23, 2022

Would love to see this update merged! This would also bring webp functionality to chrome-aws-lambda.

Is it still pending testing, or other?

@owlyowl
Copy link

owlyowl commented Jan 27, 2022

Is there anything we can do to help get the update merged?
Thanks!

@bestplay9384
Copy link

bestplay9384 commented Jan 27, 2022

This repository has no contributors other than @alixaxel - the owner. The only one who can merge it is Him, just be patient. He is maintaining repo in his free time :) All you can do for now - download this PR and test it individually, provide some info when any bugs are detected :)

@mkubenka
Copy link

mkubenka commented Jan 27, 2022

You can use this PR as a dependency:

npm i alixaxel/chrome-aws-lambda#puppeteer@12

Installing the branch does not work for me.

@Sparticuz Maybe try to update npm.

@alixaxel
Copy link
Owner Author

Hey everyone, sorry for the radio silence on this but between work commitments and my recent introduction to fatherhood I haven't been able to find the necessary time to solve some problems that affect this release.

Regarding the update to puppeteer v12 (and above), recent changes in Chromium 93+ seem to have introduced different requirements for the SwiftShader library, which means that with the current approach and with the limitations present within the Lambda environment it won't be possible to, for instance, render WebGL content. 😥

I'm still investigating workarounds to solve this issue, but each attempt requires a few time-consuming steps:

  1. Recompiling Chromium.
  2. Tracing and bundling needed shared libraries.
  3. Tweaking startup arguments to try to find a working combination.

I've already managed to make some interesting findings, but the approach is still not very elegant (and increases the package size considerably). So rather than releasing a new version that introduces a regression that would be disruptive to a significant user base, I rather spend the time needed to come up with a proper fix.

In the meantime, if someone doesn't need WebGL support, you can just clone this branch locally and build a Layer out of it.

I can also open a branch targeting v13.x with the updated binaries, if that would be helpful.

@Sparticuz
Copy link

Thank you for the update and congrats on fatherhood!!

@Hideman85
Copy link

Hideman85 commented Jan 31, 2022

That's super news thanks for the update, I'm gonna look at it because I really need to find a stable pdf generator and only recent version fix my issue #255

Would be super nice to release that branch on npm with alpha/beta/next tag what you think?

@rahul-raut
Copy link

rahul-raut commented Feb 2, 2022

@alixaxel Congratulations on fatherhood! and thanks for the update :)

@jpike88
Copy link

jpike88 commented Feb 7, 2022

@alixaxel WebGL seems like a pretty niche use case to be blocking this on. Those who desperately need to use WebGL can just sit on an older version, but the random occurrence of (IO.close): Target closed is far more of a problem to prioritise don't you think? Why not just throw this on a next or beta tag in npm?

@jpike88
Copy link

jpike88 commented Feb 10, 2022

just to confirm, building from this branch worked well, so far no issues

@owlyowl
Copy link

owlyowl commented Feb 10, 2022 via email

@jpike88
Copy link

jpike88 commented Feb 10, 2022

@owlyowl for use in Lambda environments. This allows a minimal lambda payload to be updated, and in turn means that you can deploy quickly and even use the live code editor because the payload will be unzip 3mb uncompressed

@Sparticuz
Copy link

@alixaxel What's the reasoning behind changing to an Ubuntu based image in b6c1aee ? Shouldn't chromium be built using the amazonlinux image?

@Sparticuz
Copy link

Sparticuz commented Mar 4, 2022

Chromium 93+ seem to have introduced different requirements for the SwiftShader library

Are these compile requirements or runtime requirements? I've been able to successfully compile build 99.0.4844.0 (puppeteer 13.4.1) on amazonlinux2022 (amazonlinux2 seems to have an out of date version of gcc). I would love some more information so I can help get this package back up to date. Do you have any tests that run to verify the binary? How do you test WebGL?

@supriyo-biswas
Copy link

@Sparticuz you can test WebGL by using one of the demos, such as https://webglsamples.org/aquarium/aquarium.html. Of course only @alixaxel can tell us if he has a private testsuite to check for bugs of this kind.

@supriyo-biswas
Copy link

@alixaxel, you've mentioned that:

I've already managed to make some interesting findings, but the approach is still not very elegant (and increases the package size considerably).

Could you elaborate on the approach that you've taken to get a working version (despite the disadvantages that come with it)? I'd like to lend a hand in solving this problem and it would be good to know what you've tried so far as an initial starting point in investigating the issue.

@Sparticuz
Copy link

Sparticuz commented Mar 8, 2022

@alixaxel @supriyo-biswas It looks to me like the problem might have been the old ami image you were using. Like I said earlier, I was able to compile (using a docker based image) in amazonlinux2022. (I know it's still in beta, but I believe it should be coming out of beta very soon, probably with the release of node16.x). Here is a remote debugging devtools of the site that @supriyo-biswas suggested using:
image

I'll see if I can get the ansible playbook updated to run a build on aws instead of my local dockerfile.

EDIT: my brotli sizes were 47 megs for chromium.br and 2.7 megs for swiftshader.tar.br

EDIT2: As @supriyo-biswas said, it was also be very useful if we knew more about your tests. Even more useful would be if we could write a test suite.

@Sparticuz
Copy link

I've updated the ansible playbook file and my changes are available in #264, however, after building on EC2 using the ansible file, I'm not able to recreate the webgl success I had using the binary I compiled in an amazonlinux2022 dockerfile.

[0308/143647.826531:ERROR:gpu_channel_manager.cc(831)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[0308/143647.826627:ERROR:shared_image_stub.cc(537)] SharedImageStub: unable to create context

@Sparticuz
Copy link

I've gotten Chromium up to the latest puppeteer version in my PR #264 and it seems to be working for me. Anyone who would like to test it out can checkout that PR can build the layer using the following steps if you want to compile yourself. You'll need environmental variables of AWS_REGION, AWS_ACCESS_KEY, and AWS_SECRET_KEY for the ansible playbook. I would also change the _/ansible/plays/chromium.yml file to have ec2 -> instance_type to be a c6i.12xlarge with a spot_price of 0.90. make chromium takes about 55 minutes to compile and download.

git clone https://github.com/Sparticuz/chrome-aws-lambda
cd chrome-aws-lamba
git checkout puppeteer@13.5.0
cd _/ansible
make
make chromium
cd ../..
mv bin/chromium-*.br bin/chromium.br
make

That should give you chrome_aws_layer.zip which you can use as a layer

...or if you want to skip all that, here is the Lambda layer with support for puppeteer@13.5.0 and chromium@100.0.4889.0 https://raw.githubusercontent.com/Sparticuz/chrome-aws-lambda/b4584a6c65e1c33d7a1afc1edbb825ee4f2509a6/chrome_aws_lambda.zip

@Sparticuz Sparticuz mentioned this pull request May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet