azure-functions-host: Chrome headless doesn't work on Azure Functions on Linux

Investigative information

Please provide the following:

  • Timestamp: 2019-09-04
  • Function App version (1.0 or 2.0): 2.0

Repro steps

  1. Add this code to you function (in my case, type httpTrigger)
const puppeteer = require('puppeteer');
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'example.png' });
await browser.close();

Expected behavior

It should works

Actual behavior

An exception is throw:

message: spawn EACCES
stack: Error: spawn EACCES
    at ChildProcess.spawn (internal/child_process.js:313:11)
    at Object.exports.spawn (child_process.js:508:9)
    at Launcher.launch (/home/site/wwwroot/node_modules/puppeteer/lib/Launcher.js:133:40)
    at <anonymous>

Known workarounds

I don’t know any.

Related information

According to this comment: https://github.com/Azure/azure-functions-host/issues/2417#issuecomment-366043565 It should work on linux, but we get the same error as in windows.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 28 (11 by maintainers)

Most upvoted comments

@anthonychu thank you for the update!!

Are there plans for this to also work on Windows plans?

Having something that can work on one runtime but not another, on one plan type but not another, even though it works in the local development environment really negates the “serverless” part of functions - ideally this should all be abstracted away and not a developers concern

@sarvaje @benjamineberle @hyperyn You can now run headless Chromium on Linux Consumption. Hope to have more official docs in the future but for now, check out this blog post for the steps to get it working.