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

[BUG] #270

Open
dashcraft opened this issue Apr 29, 2024 · 15 comments
Open

[BUG] #270

dashcraft opened this issue Apr 29, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@dashcraft
Copy link

Environment

  • chromium Version: "@sparticuz/chromium": "^119.0.2",
  • puppeteer / puppeteer-core Version: "puppeteer-core": "^21.5.0",
  • Node.js Version: nodejs18.17.0
  • Lambda / GCF Runtime: nodejs18.x.x

Expected Behavior

Puppeteer should've launched normally.

Current Behavior

Recently lambdas on Nodejs18.x.x have started failing to launch the browser process for chromium with the following error:
"error":{"name":"TargetCloseError","cause":{"name":"ProtocolError"}}

Spartacuz chromium v118.0.0 was previously working fine on lambdas and stopped working.

I attempted to upgrade to run on Spartacuz chromium v123, but it fails to run due to the following error:
Error: spawn ETXTBSY

Steps to Reproduce

Possible Solution

Not sure, there seems to be some child process issues when loading the binary in the latest version which should be fixed.

@dashcraft dashcraft added the bug Something isn't working label Apr 29, 2024
@joaodezembro
Copy link

Same problem here. Was also working fine 1 month before

@acdrDev
Copy link

acdrDev commented Apr 29, 2024

I had the same problem, apparently there is a new version in the lambda runtime, in this new version are needed the files that are added in version 119.0. 2 of “@sparticuz/chromium”, so if you had a version lower than this and also had to configure the version of the lambda runtime as “Auto” this will take the latest version making you generate an error when launching the browser, can be solved by updating the package “@sparticuz/chromium” to version 119.0.2 or higher (I updated to version 121), or manually adding the ARN of the previous version of the runtime.

@dashcraft
Copy link
Author

I had the same problem, apparently there is a new version in the lambda runtime, in this new version are needed the files that are added in version 119.0. 2 of “@sparticuz/chromium”, so if you had a version lower than this and also had to configure the version of the lambda runtime as “Auto” this will take the latest version making you generate an error when launching the browser, can be solved by updating the package “@sparticuz/chromium” to version 119.0.2 or higher (I updated to version 121), or manually adding the ARN of the previous version of the runtime.

I updated to 121 but then i get the error relate to Error: spawn ETXTBSY when trying to load the executable path during browser spawn process.

@joaodezembro
Copy link

I had the same problem, apparently there is a new version in the lambda runtime, in this new version are needed the files that are added in version 119.0. 2 of “@sparticuz/chromium”, so if you had a version lower than this and also had to configure the version of the lambda runtime as “Auto” this will take the latest version making you generate an error when launching the browser, can be solved by updating the package “@sparticuz/chromium” to version 119.0.2 or higher (I updated to version 121), or manually adding the ARN of the previous version of the runtime.

For me, it's fixed! Thank you

I had the same problem, apparently there is a new version in the lambda runtime, in this new version are needed the files that are added in version 119.0. 2 of “@sparticuz/chromium”, so if you had a version lower than this and also had to configure the version of the lambda runtime as “Auto” this will take the latest version making you generate an error when launching the browser, can be solved by updating the package “@sparticuz/chromium” to version 119.0.2 or higher (I updated to version 121), or manually adding the ARN of the previous version of the runtime.

I updated to 121 but then i get the error relate to Error: spawn ETXTBSY when trying to load the executable path during browser spawn process.

I'm using the following versions:

  • "@sparticuz/chromium": "121.0.0",
  • "puppeteer-core": "21.5.2",
  • runtime: nodejs18.x
  • memorySize: 2048

It's ok now for me

@acdrDev
Copy link

acdrDev commented Apr 29, 2024

I had the same problem, apparently there is a new version in the lambda runtime, in this new version are needed the files that are added in version 119.0. 2 of “@sparticuz/chromium”, so if you had a version lower than this and also had to configure the version of the lambda runtime as “Auto” this will take the latest version making you generate an error when launching the browser, can be solved by updating the package “@sparticuz/chromium” to version 119.0.2 or higher (I updated to version 121), or manually adding the ARN of the previous version of the runtime.

I updated to 121 but then i get the error relate to Error: spawn ETXTBSY when trying to load the executable path during browser spawn process.

could you share with me the code with which you are running chromium to try to replicate the error?

for now you can change the runtime in the lambda configuration, you can go to the CloudWatch logs and look for a log of when the function was still running, copy the runtime arn, it is the first message that appears in those logs, then go to the function configuration, in the “Code” section look for the runtime configuration and click on edit, mark it as “Manual” and paste the ARN that you just copied.

@dashcraft
Copy link
Author

dashcraft commented Apr 29, 2024

Copying the arn runtime (18.26) worked! runtime (18.28) was definitely causing the issue. For v123, here's a snippet of code that should reproduce the error.

Below snippet:
v123.0.1 chromium/sparticuz
nodejs20.x.x runtime


import puppeteer from "puppeteer-core";
import chromium from "@sparticuz/chromium";

export async function handle() {
    let path = await chromium.executablePath("https://github.com/Sparticuz/chromium/releases/download/v123.0.1/chromium-v123.0.1-pack.tar")
    let configs = {
        args: chromium.args,    
        defaultViewport: chromium.defaultViewport,
        protocolTimeout: 720_000,
        executablePath: path,
        headless: true
    }

    const browser = await puppeteer.launch(configs);
}

This results in an error...:

Error Error: spawn ETXTBSY
    at ChildProcess.spawn (node:internal/child_process:421:11)

@acdrDev
Copy link

acdrDev commented Apr 30, 2024

Error: spawn ETXTBSY

I was trying in node 18 and 20 but in both cases it worked correctly, to replicate your error I had to lower the memory allocated to 128MB and lower the timeout, maybe this is what was causing the error, could you confirm me if the memory you allocated to the lambda is higher than 512MB.

@dashcraft
Copy link
Author

I may have some surface area for memory issues, since i'm using sst and not serverless to deploy./
It's got some bloat to it.

image

@BrianBorge
Copy link

We had the same issue happen to us this morning. We change out our versions of puppeteer-core, @sparticuz/chromium, and runtime to match the versions in the comment here 👉 #270 (comment).

This worked for us - thank you @joaodezembro

@dashcraft
Copy link
Author

@BrianBorge I'll try that out and see if that helps, thanks! I'll report back!

@AkbarHabeeb
Copy link

@joaodezembro It will be great if you have any suggestions on the compatible versions for the node 16 runtime env?

@joaodezembro
Copy link

@joaodezembro It will be great if you have any suggestions on the compatible versions for the node 16 runtime env?

@AkbarHabeeb , sadly i don't have. we migrated straight from node 14.x, when AWS removed the support for 14 we jumped for the 18.x..

In last occasion you can set the AMI version for your lambda to 2 or 3 versions before and, if was working before, will work again, if wasn't, you need to play between puppeteer-core versions and you can't change the chromium bellow 119.0.2

But honestly the true recommendation is to upgrade your node version

@dashcraft
Copy link
Author

dashcraft commented May 1, 2024

@BrianBorge still get the: ETXTBSY error with those settings

@intxjohann
Copy link

We had the same ProtocolError in lambda
Runtime Version: nodejs:16.v35 failed, nodejs:16.v33 however worked so we changed to this one for now

@dashcraft
Copy link
Author

The ETXBSY is only when i try to run v119+ and node 18 or node 20. Ideally i'd like to use node 20, but that didn't work when i tried it. I've currently lowered everything to node 18.26 via the runtime management arn technique mentioned and that's unbroken all the scrapers we have running atm.

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

6 participants