With a recent update to Azure Functions, it is now possible to run headless Chromium in the Linux Consumption plan. This enables some serverless br...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for publishing this article it really helped me.
I went through the steps, except that I upload a zip from CI, since my function references files outside the functions root dir, and I get:
I wonder if I'm missing a step to configure the user access.
Hi @bennypowers , did you find fix for this?
IIRC you need to build it on the remote
I think you may also need to set an ENV var which specifies that chromium should install in the repo working dir, or something like that
Hi,
Thank you for a very helpful article! With your help I've been almost able to make playwright to work on linux consumption plan. The problem that still exists seems to be that the function does not have access to start the browser process:
Error: browserType.launch: Failed to launch: Error: spawn /home/site/wwwroot/node_modules/playwright-chromium/.local-browsers/chromium-907428/chrome-linux/chrome EACCES)
Googling shows that this problem might arise only when deploying through azure devops pipeline, which I'm doing.
Do you or anyone else have any ideas on what could be the solution for this problem?
Thousand thanks! ๐โโ๏ธ
Hi @ronkot , Did you get any solution for this? Please help me out. I am also facing this issue. Please have a look on the below error.
An unexpected error : { browserType.launch: Failed to launch: Error: spawn /home/site/wwwroot/node_modules/playwright-core/.local-browsers/chromium-930007/chrome-linux/chrome EACCES
Unfortunately I couldn't fix the issue. Finally I just gave up using playwright. I'd liked to use Playwright to print html page to pdf, but I refactored my system to use a distinct js-only mechanism to generate PDFs using
pdfmake
.Hi Anthony,
I'm unable to get either the puppeteer/playwright functions to run successfully in Azure - they run fine locally, but once deployed, they fail with the below error:
Result: Failure Exception: Worker was unable to load function GeneratePDF: 'Error: Cannot find module 'playwright-chromium' Require stack: - /home/site/wwwroot/GeneratePDF/index.js - /azure-functions-host/workers/node/worker-bundle.js - /azure-functions-host/workers/node/dist/src/nodejsWorker.js' Stack: Error: Cannot find module 'playwright-chromium' Require stack: - /home/site/wwwroot/GeneratePDF/index.js - /azure-functions-host/workers/node/worker-bundle.js - /azure-functions-host/workers/node/dist/src/nodejsWorker.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15) at Function.Module._load (internal/modules/cjs/loader.js:841:27) at Module.require (internal/modules/cjs/loader.js:1025:19) at require (internal/modules/cjs/helpers.js:72:18) at Object. (/home/site/wwwroot/GeneratePDF/index.js:1:22) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Module.require (internal/modules/cjs/loader.js:1025:19)
Any ideas?
@Darshan - did you ever manage to resolve this? I'm getting the same thing.
Edit: I solved it using some of the advice here (stackoverflow.com/questions/639499...), and by making sure I deployed by right-clicking on my project in VS Code and choosing "Deploy to Function App..." rather than doing it at the command-line.
@tom , no I didn't in the end - but glad you got it to work in the end. When I get a chance I will try and get mine to work as well!
When deploying from VSCode, "azureFunctions.scmDoBuildDuringDeployment": true conflicts with
Error: Run-From-Zip is set to a remote URL using WEBSITE_RUN_FROM_PACKAGE or WEBSITE_USE_ZIP app setting. Deployment is not supported in this configuration.
Error: Linux consumption plans only support zip deploy. See here for more information.
I'm not sure if I missed a step.
Is this a new Linux Consumption plan that you're deploying to? I didn't run into this with a new app. This is likely because one of those settings were previously added to the app. You should be able to delete that app setting and try again. Let me know if it works.
Hi Anthory,
Is there a similar way to get this working using selenium webdriver? Things work fine locally but once deployed, I keep running into 'Exception: WebDriverError: unknown error: cannot find Chrome binary'
Any idea whether we can do remote build from Azure Devops Release Pipeline?
Is this working same way for v4 functions and node 16 lts?
The article was amazing.
Can I use this solution with a function running in a kubernetes cluster with Keda?
Hi Anthony. Is there any ETA for adding the ability to run headless Chromium from App Service Plans?