Azure / Azure/azure-functions-host
Chrome headless doesn't work on Azure Functions on Linux
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
#### 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
```
#### 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.
Contributor guide
Research direction
Start with the provided Azure Functions 2.0 Linux reproduction and the stack trace at node_modules/puppeteer/lib/Launcher.js:133:40. Investigate why Puppeteer's browser process receives spawn EACCES in this hosting environment, then verify the example function can launch, navigate, capture a screenshot, and close the browser successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, javascript
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100