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]: Error: Failed to launch the browser process! #27

Closed
milindsingh opened this issue Dec 26, 2022 · 18 comments
Closed

[BUG]: Error: Failed to launch the browser process! #27

milindsingh opened this issue Dec 26, 2022 · 18 comments
Labels
bug Something isn't working

Comments

@milindsingh
Copy link

Environment

  • chromium Version: 106
  • puppeteer / puppeteer-core Version: 18.2
  • Node.js Version: 16
  • Lambda / GCF Runtime: AWS Lambda

Expected Behavior

Should work.

Current Behavior

2022-12-26T16:30:16.851Z	fc7bd134-b96f-45f3-b681-961ec5abc5c9	INFO	Error: Failed to launch the browser process!

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/var/task/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:299:20)
    at Interface.<anonymous> (/var/task/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:287:24)
    at Interface.emit (node:events:539:35)
    at Interface.emit (node:domain:475:12)
    at Interface.close (node:readline:586:8)
    at Socket.onend (node:readline:277:10)
    at Socket.emit (node:events:539:35)
    at Socket.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Steps to Reproduce

Followed same steps as in doc

Possible Solution

Any guide to debug ? Also, I am using Typescript.

@milindsingh milindsingh added the bug Something isn't working label Dec 26, 2022
@milindsingh milindsingh changed the title [BUG] [BUG]: Error: Failed to launch the browser process! Dec 26, 2022
@lukasburns
Copy link

Same here, did you got it working?

@Sparticuz
Copy link
Owner

You might be able to enable debug mode in puppeteer to see what the exact problem is https://pptr.dev/guides/debugging/#log-devtools-protocol-traffic

@mferraco
Copy link

mferraco commented Jan 5, 2023

I have this same problem. Also followed the steps in the doc.

{
    "errorMessage": "Failed to launch the browser process!\n/tmp/chromium: /tmp/chromium: cannot execute binary file\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n",
    "errorType": "Error",
    "stackTrace": [
        "Error: Failed to launch the browser process!",
        "/tmp/chromium: /tmp/chromium: cannot execute binary file",
        "",
        "",
        "TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md",
        "",
        "    at onClose (/path-hidden/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:299:20)",
        "    at Interface.<anonymous> (/path-hiddden/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:287:24)",
        "    at Interface.emit (node:events:525:35)",
        "    at Interface.emit (node:domain:489:12)",
        "    at Interface.close (node:readline:590:8)",
        "    at Socket.onend (node:readline:280:10)",
        "    at Socket.emit (node:events:525:35)",
        "    at Socket.emit (node:domain:489:12)",
        "    at endReadableNT (node:internal/streams/readable:1358:12)",
        "    at processTicksAndRejections (node:internal/process/task_queues:83:21)"
    ]
}

@Sparticuz
Copy link
Owner

Just to make sure, you are using the standard node lambda, not the graviton lambda? Will someone post a complete example with SAM/SLS code also?

@mbaranovski
Copy link

Same error, both locally and on the AWS. Something's wrong with the chromium binary. Locally getting:

/var/folders/ky/0b0rg2gx3n76wld77st1ysch0000gn/T ./chromium
zsh: exec format error: ./chromium

Also, the Makefile does not install puppeteer-core and the example showing migration from chrome-aws-lambda to your package is not working out of the box. Had to manually install the puppeteer-core package but then the error above.

@Sparticuz
Copy link
Owner

Are you running on ARM?

Yes, puppeteer-core or playwright are required dependencies, but I don't package them with the app like chrome-aws-lambda did.

@mbaranovski
Copy link

mbaranovski commented Jan 10, 2023

I falled back to chrome-aws-lambda which also had issues with nodejs lambda but I set lambda all the way down to node 14(default is node 18) and it started working. I haven't tested if this would be the fix for your package as well though.

@mbaranovski
Copy link

Ah and no, I'm running on Intel.

@twistypigeon
Copy link

twistypigeon commented Jan 12, 2023

I'm getting very similar issue although with slightly more detail in the AWS Lambda log

2023-01-12T17:27:07.854Z	d43c0b19-6477-4778-82f7-e9f616dd7140	INFO	Error: Failed to launch the browser process!
/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/var/task/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:299:20)
    at Interface.<anonymous> (/var/task/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:287:24)
    at Interface.emit (node:events:525:35)
    at Interface.close (node:internal/readline/interface:536:10)
    at Socket.onend (node:internal/readline/interface:262:10)
    at Socket.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Missing shared libraries in the lambda runtime environment?
I'm trying to upgrade from Node14.x to Node18.x. 14 was running fine and 18 does not. I've not redownloaded or remakeed my chromium layer. Maybe I need to do that?

I believe chromium version I have is 107.
Attempting to use node18.x as stated.
puppeteer-core is ^19.0.0
x64 arch.

Readme says this should be usable with node18. Not sure what I am doing wrong?

@kyoya0819
Copy link

I have the same problem.

/tmp/chromium seems to be unpacked, but Puppeteer does not seem to recognize it.

Error Message

{
  "errorType": "Error",
  "errorMessage": "Failed to launch the browser process!\n/tmp/chromium: /tmp/chromium: cannot execute binary file\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n",
  "trace": [
    "Error: Failed to launch the browser process!",
    "/tmp/chromium: /tmp/chromium: cannot execute binary file",
    "",
    "",
    "TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md",
    "",
    "    at onClose (/var/task/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:194:20)",
    "    at Interface.<anonymous> (/var/task/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:184:68)",
    "    at Interface.emit (node:events:539:35)",
    "    at Interface.close (node:readline:586:8)",
    "    at Socket.onend (node:readline:277:10)",
    "    at Socket.emit (node:events:539:35)",
    "    at endReadableNT (node:internal/streams/readable:1345:12)",
    "    at processTicksAndRejections (node:internal/process/task_queues:83:21)"
  ]
}

/tmp Directory Files.

スクリーンショット 2023-01-13 14 22 36

Function Environment

  • Node.js ... 16
  • RAM ... 2048MB
  • Ephemeral Disk ... 2048MB
  • @sparticuz/chromium ... 109.0.1
  • puppeteer-core ... 19.4.1

@twistypigeon
Copy link

Update to my previous post about this issue.
I've managed to successfully rebuild my package. Turns out a rebuild of the chomium layer was also required.
Now running Chromium 109.0.1 on AWS lambda Node18.x

@kyoya0819
Copy link

kyoya0819 commented Jan 13, 2023

I was able to change some settings and fix this error.
I apologize for the inconvenience caused.
I found that setting arm64 as the architecture failed; setting it to x86_64 made it work with both Node.js 16 and 18.

@Sparticuz
Copy link
Owner

Great! I'm about ready to publish some changes that will help take more of the guess work out of using the layer.

Unfortunantly, arm support is still a bit off. The OS that runs Lambda is amazonlinux2 which is very out of date on a few things. I'm tracking the changes to amazonlinux2022 and when Lambda switches to it, arm support will be very close behind.

@PickertJoe
Copy link

@twistypigeon Would you mind sharing how you rebuilt your chromium package? I'm currently encountering the same issue as you with the exact same package versions. Thank you!

@kaykhan
Copy link

kaykhan commented Jan 21, 2023

Im also getting this same error:

  "dependencies": {
    "@sparticuz/chromium": "^109.0.6",
    "fs-extra": "^11.1.0",
    "puppeteer-core": "19.4.0",
    "puppeteer-extra": "^3.3.4",
    "puppeteer-extra-plugin-stealth": "^2.11.1",
    "youtube-dl-exec": "^2.1.11"
  },

I use puppeteer-extra as my base puppeteer i wonder if thats causing an issue?

{
    "statusCode": 500,
    "body": "{\"message\":\"Failed\",\"error\":\"Error: Failed to launch the browser process!\\n\\n\\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\\n\\n    at onClose (/home/kay/kay/livestreamfailclips/node_modules/puppeteer-core/src/node/BrowserRunner.ts:328:9)\\n    at Interface.<anonymous> (/home/kay/kay/livestreamfailclips/node_modules/puppeteer-core/src/node/BrowserRunner.ts:314:16)\\n    at Interface.emit (node:events:525:35)\\n    at Interface.emit (node:domain:489:12)\\n    at Interface.close (node:internal/readline/interface:536:10)\\n    at Socket.onend (node:internal/readline/interface:262:10)\\n    at Socket.emit (node:events:525:35)\\n    at Socket.emit (node:domain:489:12)\\n    at endReadableNT (node:internal/streams/readable:1359:12)\\n    at processTicksAndRejections (node:internal/process/task_queues:82:21)\"}"

@jeanhdev
Copy link

jeanhdev commented Sep 7, 2023

Any update on this ?

@Sparticuz
Copy link
Owner

The two issues in this thread have been fixed (arm vs x86, and trouble with the layer). If you are having problems, please open a new issue with enough information to troubleshoot.

@GrayedFox
Copy link

Update to my previous post about this issue. I've managed to successfully rebuild my package. Turns out a rebuild of the chomium layer was also required. Now running Chromium 109.0.1 on AWS lambda Node18.x

@twistypigeon hey champ, sorry to necro an old post here but I wanted to ask if by rebuilding your chromium layer, you mean rebuilding it for AWS Layers, or you are building the chromium app yourself for the right architecture?

Me and my team are blocked from releasing changes right now due to getting this error upstream (on a serverless lambda) but cannot seem to reproduce it locally

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