puppeteer-sharp: ChromiumProcessException: Failed to launch Chromium!

Description

When running the function in AWS lambda getting this exception.

{ “ClassName”: “PuppeteerSharp.ChromiumProcessException”, “Message”: "Failed to launch Chromium! “, “Data”: null, “InnerException”: null, “HelpURL”: null, “StackTraceString”: " at PuppeteerSharp.ChromiumProcess.State.StartingState.StartCoreAsync(ChromiumProcess p)\n at PuppeteerSharp.ChromiumProcess.State.StartingState.StartCoreAsync(ChromiumProcess p)\n at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options)\n at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options)\n at ConvertorHelpers.PdfConvertor.ConvertToPdf2(String url, String fileName, String filePath) in ConvertorHelpers\PdfConvertor.cs:line 107”, “RemoteStackTraceString”: null, “RemoteStackIndex”: 0, “ExceptionMethod”: null, “HResult”: -2146233088, “Source”: “System.Private.CoreLib”, “WatsonBuckets”: null }

Complete minimal example reproducing the issue

The executable path which is formed in lambda function after fetching the browser is “/tmp/chromium/Linux-706915/chrome-linux/chrome”

E.g.

// Arrange
 var options = new LaunchOptions
                {
                    ExecutablePath = executablePath,     
                    Headless = true,
                    Devtools = false,
                    LogProcess = true,
                    Args = new[] { "--no-sandbox" }
                };

var chromiumRevision = BrowserFetcher.DefaultRevision;
  using (var browser = await Puppeteer.LaunchAsync(options)) // Exception line 107

// Act
...

// Assert
...

Expected behavior:

launch and convert HTML to PDF

Actual behavior:

Crasehs

Versions

  • Which version of PuppeteerSharp are you using? – 2.0.3
  • Which .NET runtime and version are you targeting? E.g. .NET framework 4.6.1 or .NET Core 2.0. – .Net core 2.1 in AWS lambda

Additional Information

Its working fine when m executing it locally i.e. on my PC(windows) but on lambda function when running on Linux getting the error.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (5 by maintainers)

Most upvoted comments

Kudos guys…finally its working …able to generate pdf from URL

image

Thanks a ton!! @brianfeucht @kblok 😃

Yes, I can use in any way been lost from few days 😦 ok joke apart

so u want me to include these in my csproj of lambda ryt?

 <PackageReference Include="PuppeteerSharp" Version="2.0.3" />
    <PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.2.0" />
    <PackageReference Include="HeadlessChromium.Puppeteer.Lambda.Dotnet" Version="1.0.1.39" />

But just a bit confused why we including the “HeadlessChromium.Puppeteer.Lambda.Dotnet” this package if pupeetersharp doing all the stuff.