Azure / Azure/Azure-Functions

[Premium] NodeJS Azure Function works in Serverless/Consumption but not Premium

Open
#2,140 6 comments 0 reactions 3 assignees Claimed by @v-bbalaiagar View on GitHub
premium-plan
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

**Describe the bug**
When trying to use the NodeJS Playwright library in a Linux Premium Function the code fails with:
```
╔════════════════════════════════════════════════════════════╗
║ Host system is missing a few dependencies to run browsers. ║
║ Please install them with the following command: ║
║ ║
║ npx playwright install-deps ║
║ ║
║ <3 Playwright Team ║
╚════════════════════════════════════════════════════════════╝
```
Please note this works in a Serverless/Consumption Function just fine.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a new Premium Linux NodeJS Function with a HttpTrigger
2. Add the following dependencies {
"playwright": "^1.17.1",
"playwright-chromium": "^1.17.1"
},
3. Have code that uses playwright
```
const { chromium } = require('playwright-chromium');

module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');

const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('http://whatsmyuseragent.org/');
const screenshot = await page.screenshot({ fullPage: true });

await browser.close();

context.res = {
headers: {
"Content-Type": "image/png"
},
body: screenshot
};
}
```
4. See error

**Expected behavior**
The expected behavior is that a screenshot will be returned like it does when using a Serverless/Consumption Function.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
It seems that there are some missing OS level dependencies that are preventing this from working:
apt-get install -y \
libasound2>=1.0.16 \
libatk-bridge2.0-0>=2.5.3 \
libatk1.0-0>=2.2.0 \
libatomic1>=4.8 \
libatspi2.0-0>=2.9.90 \
libavcodec58>=7:4.2 \
libavformat58>=7:4.1 \
libavutil56>=7:4.0 \
libcairo2>=1.6.0 \
libcups2>=1.7.0 \
libdbus-1-3>=1.9.14 \
libdrm2>=2.4.38 \
libevent-2.1-7>=2.1.8-stable \
libflac8>=1.3.0 \
libgbm1>=17.1.0~rc2 \
libglib2.0-0>=2.39.4 \
libgtk-3-0>=3.19.12 \
libharfbuzz0b>=2.2.0 \
libjsoncpp24>=1.9.4 \
liblcms2-2>=2.2+git20110628 \
libminizip1>=1.1 \
libnspr4>=2:4.9-2~ \
libnss3>=2:3.22 \
libopenjp2-7>=2.2.0 \
libopus0>=1.1 \
libpango-1.0-0>=1.14.0 \
libpulse0>=0.99.1 \
libre2-9>=20201101+dfsg \
libsnappy1v5>=1.1.8 \
libvpx6>=1.7.0 \
libwebpdemux2>=0.5.1 \
libwebpmux3>=0.6.1-2+b1 \
libxcomposite1>=1:0.4.5 \
libxdamage1>=1:1.1 \
libxext6 \
libxfixes3 \
libxml2>=2.7.4 \
libxrandr2 \
libxshmfence1 \
libxslt1.1>=1.1.25

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.