skip to Main Content

I’m trying to start a headless chrome with a puppeteer in Azure Functions on Linux.

What do I do? I have a “Function App” that looks this way:

Azure Function App

And I have a function:

Azure function

I build this function remotely this way:

func azure functionapp publish {appname} --build remote

And this is what I get when I try to run a function:

Result: Failure
Exception: Failed to launch the browser process!
/home/site/wwwroot/node_modules/puppeteer/.local-chromium/linux-1011831/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory

I’ve seen this topic already (Puppeteer throws launch exception when deployed on azure functions node on Linux) but they recommend do a remote build, which I do and it still doesn’t help.

Maybe I’m using wrong App Service Plan, but I checked and there were nothing related to special linux setup there.

2

Answers


  1. Chosen as BEST ANSWER

    The reason was that I was indeed using the wrong App Service Plan. I needed a “Function App” one. When I recreated a function with the right service plan, everything worked just fine. enter image description here


    • I was able to deploy the azure function without the use of func azure functionapp publish {appname} --build remote. I did it using the visual studio code.

    • But before that I installed the puppeteer inside the function folder using

    npm install puppeteer
    
    • Then I added the node_modules name in the .funcignore file.

    • Then I added the following setting in setting.json in the .vscode folder

       "azureFunctions.scmDoBuildDuringDeployment": true
    

    enter image description here

    • Then deploy the function normally through vscode

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search