question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chromium fails to start when calling puppeteer.launch() in Azure App Service

See original GitHub issue

The line const chromeProcess = childProcess.spawn(chromeExecutable, chromeArguments, {}); in puppeteer/lib/Launcher.js is failing for me.

Line numbers in this stack trace might be off since I added logging to my local Launcher.js

{ Error: spawn UNKNOWN
    at exports._errnoException (util.js:1022:11)
    at ChildProcess.spawn (internal/child_process.js:317:11)
    at Object.exports.spawn (child_process.js:491:9)
    at Function.launch (D:\home\site\wwwroot\node_modules\puppeteer\lib\Launcher.js:86:40)
    at Function.launch (D:\home\site\wwwroot\node_modules\puppeteer\lib\Puppeteer.js:25:21)
    at __dirname (D:\home\site\wwwroot\server.js:39:29)
    ...

Environment: Azure App Service OS version: Microsoft Windows Server 2012 x64 Node: 8.1.4

chromeExecutable is D:\home\site\wwwroot\node_modules\puppeteer\.local-chromium\win32-496140\chrome-win32\chrome.exe

When I try to run chrome.exe from the command line inside the App Service I get

The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

When running locally (Windows 10 x64) I don’t have this issue.

It seems this is related to the redistributables of C/C++ installed (or not) on the system https://answers.microsoft.com/en-us/windows/forum/windows_10-performance/the-google-chrome-is-not-working-in-my-windows-10/8ecaed7a-e6e1-4097-970f-d32aaba5ec6f https://bugs.chromium.org/p/chromium/issues/detail?id=380228

Is there an alternate version of chrome.exe that I can try uploading to see if it resolves the issue?

Thanks!

Edit – It seems using this package in the Azure App Service sandbox might not be an option because of security / processing limitations.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:18
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
hdd42commented, Sep 21, 2017

had same problem and tried to use linux as ops (while you create your web app or web app for container select linux instead of windows ) this solved first part of the problem (it took you out of sandbox restrictions) after that select built -in runtime for your app (in my case selected node 8.x) and deployed it.

at that point I have to install missing necessary shared library dependencies for chrome.
Running Puppeteer in Docker

just use web ssh and install those deps maually

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &&\ sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' &&\ apt-get update &&\ apt-get install -y google-chrome-unstable

now everything ready to use Headless Chrome with Puppeteer but one more gotcha in your code need to be done, chrome has to be launched with no-sanbox flags

let browser = await puppeteer.launch({ args: [ '--no-sandbox', '--disable-setuid-sandbox' ] });

this is the only workaround i could find, hope that helps to someone

8reactions
kaushiksundarcommented, Aug 26, 2017

I am getting the same issue while launching puppeteer. { Error: spawn UNKNOWN }

Using Azure functions and Node 6.5.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chromium fails to start when calling puppeteer.launch() in ...
Chromium fails to start when calling puppeteer.launch() in Azure App Service ... The line const chromeProcess = childProcess.spawn( ...
Read more >
Error: Failed to launch the browser process puppeteer
What worked for me was: let browser = await puppeteer.launch({ executablePath: '/usr/bin/chromium-browser', args: [ '--disable-gpu', '--disable ...
Read more >
Troubleshooting - Chrome Developers
This means that the browser was downloaded but failed to be extracted correctly. The most common cause is a bug in Node.js v14.0.0...
Read more >
Running headless Chromium in Azure Functions with ...
With a recent update to Azure Functions, it is now possible to run headless Chromium in the Linux Consumption plan.
Read more >
Puppeteer Testing with TestingBot
Puppeteer Testing in the cloud on Chrome and Microsoft Edge. ... With a Puppeteer test, you'll usually start a browser with await puppeteer.launch()....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found