chrome-aws-lambda
chrome-aws-lambda copied to clipboard
Puppeteer 12.0.x
This fix many issues with crashing Chromium, for example:
[1206/231121.285380:FATAL:render_frame_impl.cc(2196)] Check failed: !in_frame_tree_.
....
Thanks! 🎉 🙇
Is there something blocking this @alixaxel?
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 🎁
You can use this PR as a dependency:
npm i alixaxel/chrome-aws-lambda#puppeteer@12
@alixaxel Upstream is now on 13.x https://github.com/puppeteer/puppeteer/releases/tag/v13.0.1
Is there any way we can update this PR with 13.x and merge it?
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.
You can use this PR as a dependency:
npm i alixaxel/chrome-aws-lambda#puppeteer@12
Installing the branch does not work for me.
Would love to see this update merged! This would also bring webp functionality to chrome-aws-lambda.
Is it still pending testing, or other?
Is there anything we can do to help get the update merged? Thanks!
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 :)
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
.
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:
- Recompiling Chromium.
- Tracing and bundling needed shared libraries.
- 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.
Thank you for the update and congrats on fatherhood!!
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 https://github.com/alixaxel/chrome-aws-lambda/issues/255
Would be super nice to release that branch on npm with alpha/beta/next tag what you think?
@alixaxel Congratulations on fatherhood! and thanks for the update :)
@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?
just to confirm, building from this branch worked well, so far no issues
I had the same experience checking out and running npm pack and including based on disk path. It works well as expected.
I still haven't been able to get an npm i
of the branch in to the repo I'd like it as a dependency working currently....
On Thu, 10 Feb 2022, 8:02 pm Josh Pike, @.***> wrote:
just to confirm, building from this branch worked well, so far no issues
— Reply to this email directly, view it on GitHub https://github.com/alixaxel/chrome-aws-lambda/pull/248#issuecomment-1034661586, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOT4CRGY42MDSC3GHXXSIDU2N5KJANCNFSM5JNEBFUQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
@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
@alixaxel What's the reasoning behind changing to an Ubuntu based image in b6c1aee6c51c21cf220a3f61f40292b6332f61a9 ? Shouldn't chromium
be built using the amazonlinux
image?
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?
@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.
@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.
@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:
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.
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
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 [email protected]
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 [email protected] and [email protected] https://raw.githubusercontent.com/Sparticuz/chrome-aws-lambda/b4584a6c65e1c33d7a1afc1edbb825ee4f2509a6/chrome_aws_lambda.zip