How to run Headless Chrome in Azure Cloud Service or Azure Functions? How to run Headless Chrome in Azure Cloud Service or Azure Functions? azure azure

How to run Headless Chrome in Azure Cloud Service or Azure Functions?


I would recommend to use https://www.browserless.io/ so you don't have to run the chrome.exe in the app service.

Replace puppeteer.launch with puppeteer.connect

const browser = await puppeteer.connect({  browserWSEndpoint: 'wss://chrome.browserless.io/'});


I'm not sure about the usage of Headless Chrome, but the sandbox that Azure Functions runs in has problems generating PDFs from HTML due to some GDI restrictions.

Consider trying your task in Azure Functions on Linux. While this is still in preview, it does not utilize a sandbox, so if you can get headless chrome working on it then you may have more luck with the PDF generation.


Azure allows NodeJS:

you can do it in NodeJS using Phantom (instead of chrome since you wont have access to any browsers - nor will you be able to run them on azure web apps) see the example - its in hosted on google firebase but you can easily apply it to your NodeJS project:

https://stackoverflow.com/a/51828577/6306638

IIS server on a Azure VM is your only alternative if you NEED Chrome.

Let me know if you need any help with this!