Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux premium image does not have libraries needed to run headless Chrome #333

Open
ChrisFulstow opened this issue Sep 22, 2020 · 19 comments

Comments

@ChrisFulstow
Copy link

Running PuppeteerSharp on an Azure Functions Linux premium plan reports the error below, however it works fine on a Linux consumption plan. Would it be possible to get the libraries required to run headless Chrome, like libX11, added to the Linux premium images?

/tmp/Linux-706915/chrome-linux/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

These are the App Service plans I tested:

Doesn't work (Premium)

const appServicePlan = new appservice.Plan(appServicePlanName, {
  reserved: true,
  kind: "elastic",
  sku: { tier: "ElasticPremium", size: "EP1" },
});

Works fine (Consumption)

const appServicePlan = new appservice.Plan(appServicePlanName, {
  reserved: true,
  kind: "FunctionApp",
  sku: { tier: "Dynamic", size: "Y1" },
});

Here's the C# .NET Core 3.1 application code running in my Azure Function:

var browserFetcherOptions = new BrowserFetcherOptions { Path = Path.GetTempPath() };
var browserFetcher = await new BrowserFetcher(browserFetcherOptions).DownloadAsync(BrowserFetcher.DefaultRevision);
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
    Headless = true,
    ExecutablePath = browserFetcher.ExecutablePath
});
using var page = await browser.NewPageAsync();
await page.GoToAsync(baseUrl);
@anthonychu
Copy link
Member

Thanks for reporting this. Looks like the headless Chromium dependencies are in the consumption .NET images but not the premium ones. @ahmelsayed Could you please take a look?

@anthonychu
Copy link
Member

+ @divyagandhii also

@gugavaro
Copy link

This is something that is blocking one of my projects as well. Would be great if we could have it fixed.
Do we have any ETA for fixing it?
If help is needed, I could try to fix and submit a PR
let me know.

thanks!

@balag0
Copy link
Collaborator

balag0 commented Jan 21, 2021

As a workaround you can try building your own image (based of functions blessed images) and include the debian dependencies listed under
https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix

@ahmelsayed
Copy link
Contributor

Sorry I missed this issue. The chrome-headless deps were only in node images. This #368 should add it to dotnet images used in appservice as well.

@gugavaro
Copy link

@ahmelsayed I saw you fixed #368, how long it takes to replicate? I just deploy a new Azure Functions and still getting errors, it does not seem to be using an image with your changes yet.
thanks!

@balag0
Copy link
Collaborator

balag0 commented Jan 29, 2021

We just finished deploying https://github.com/Azure/azure-functions-host/releases/tag/v3.0.15277 today. So the earliest the next release could begin is in a week's time. Will that work?

@gugavaro
Copy link

Hi @balag0 any updates on this? I deployed a new function last night and still hitting the errors.
let me know.

thanks,
Gustavo.

@balag0
Copy link
Collaborator

balag0 commented Feb 24, 2021

New image with functions host Version 3.0.15405 is currently being deployed (which has the fix) and should complete tomorrow. If you can share your app name I can give you a more accurate status as well - https://github.com/Azure/azure-functions-host/wiki/Sharing-Your-Function-App-name-privately

@Esperteyu
Copy link

Hi,

Even though the last message seems to say the opposite the libraries seem to be missing still. Or is it me missing something?

Thanks

@trustii-mbroy
Copy link

trustii-mbroy commented Jun 21, 2022

Hi @balag0 and @anthonychu

I just moved from Consumption Plan to Premium Plan and I seem to be facing the same issue as described here by ChrisFulstow.

Is it possible this was never fixed?

Info:
.NET 6 with runtime dotnet-isolated and linuxFxVersion '"DOTNET-ISOLATED|6.0"'

@nyds
Copy link

nyds commented Jun 22, 2022

Unfortunately the host v4 images for .NET 6, either isolated or in-process Azure Functions are also missing the required dependencies to run chromium. This is due to a deprecated package (libappindicator1) in the Linux Debian 11 distribution (bullseye). See linked issue: #451

For reference see the comments in the host v4 templates:

# This is current not working with the .NET 6.0 image based on bullseye. Tracking here: https://github.com/Azure/azure-functions-docker/issues/451

# This is current not working with the .NET 6.0 image based on bullseye. Tracking here: https://github.com/Azure/azure-functions-docker/issues/451

@trustii-mbroy Did you manage to get chromium to run in a .NET 6 isolated function on a consumption plan?

@trustii-mbroy
Copy link

trustii-mbroy commented Jun 22, 2022

@nyds : That's odd, I've been running PuppeterSharp with chromium on dotnet 6 isolated from the consumption plan for a few months now.

Do you know what NET6.0 images on the consumption plan are used?

EDIT: Should I be worried that it could stop working on my production/consumption environment? As-in if a new version of the image is released.

@nyds
Copy link

nyds commented Jun 29, 2022

@trustii-mbroy Sadly I have no idea, there's hardly any documentation on the images used across the different plans. I also can't say whether it will break on the Consumption plan in the future. My earlier comment was solely based on a bit of research I did to figure out why it didn't work.

@nyds
Copy link

nyds commented Jul 11, 2022

I've rebuilt the dotnet6-isolated image locally and replaced libappindicator1 for its successor libayatana-appindicator3-1. After this the image builds correctly and can be used as a function host container to run headless chrome.

@CooperLink
Copy link
Collaborator

Thank you all for identifying this issue with our deprecated dependency. I have just addressed this in all v4 images and the fix should be released starting in the 4.10.0 release cycle. I will keep this issue open until I am able to merge the PR.

@CooperLink
Copy link
Collaborator

#815

This issue has been resolved in Node 14/16/18 images as of 4.15.2 release. Deployment expected end of February

@cjgaspari
Copy link

@CooperLink does this fix the issue for those using .NET and Premium Functions?

I have code that works perfectly in the Consumption Linux environment, but fails in the Premium due to missing libraries.

@seerj30
Copy link

seerj30 commented Jun 10, 2024

Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests