question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LaunchAsync failed on Azure as a Windows/Linux .net core 5 App service

See original GitHub issue

My service is working perfectly locally however when I deploy it on Azure as a Windows .net core 5 Free App service, It throws following exception. My code is shown below.

What is the reason for this? Do I have to install any additional components?

var bf = new BrowserFetcher();
            await bf.DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
            var options = new LaunchOptions
            {
                Headless = true,
                ExecutablePath = bf.GetExecutablePath(BrowserFetcher.DefaultChromiumRevision)
            };

            List<NewsItem> newsItems = new List<NewsItem>();
            using (var browser = await Puppeteer.LaunchAsync(options)) **<= exception thrown here**
            using (var page = await browser.NewPageAsync())
            {
                await page.GoToAsync(url);

Exception: 
System.ComponentModel.Win32Exception (14001): The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at PuppeteerSharp.States.ChromiumStartingState.StartCoreAsync(LauncherBase p) in C:\projects\puppeteer-sharp\lib\PuppeteerSharp\States\ChromiumStartingState.cs:line 68
   at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in C:\projects\puppeteer-sharp\lib\PuppeteerSharp\Launcher.cs:line 63
   at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in C:\projects\puppeteer-sharp\lib\PuppeteerSharp\Launcher.cs:line 86
   at NewsAnalyzer.AsxNewsManager.GetNewsItems() in C:\Users\t\source\repos\NewsAnalyzer\NewsAnalyzer\NewsManager.cs:line 24
   at NewsApi.Controllers.NewsController.Post() in C:\Users\t\source\repos\NewsAnalyzer\NewsApi\Controllers\NewsController.cs:line 44
   at lambda_method5(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()

I also checked on Linux app service. I end up getting following error when I follow the code here . When I checked the tmp folder it did not have any chrome folders.

Failed to launch browser! /tmp/Linux-884014/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

I also checked changing the folder to /home/ on linux. This time it downloaded chrome and had all required folders. But now it ended up throwing

Failed to launch browser! Failed to launch browser! /home/Linux-884014/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kblokcommented, Jan 16, 2023

Closed due to inactivity. Feel free to reopen it if needed.

0reactions
sagarsrivastava2111commented, Oct 31, 2022

OKay, thanks for your time. I guess I’ll also have to move to some option other than puppeteer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PuppeteerSharp LaunchAsync failed on Azure as a ...
My service is working perfectly locally however when I deploy it on Azure as a Windows .net core 5 Free App service, It...
Read more >
Troubleshoot ASP.NET Core on Azure App Service and IIS
Learn how to diagnose problems with Azure App Service and Internet Information Services (IIS) deployments of ASP.NET Core apps.
Read more >
Common error troubleshooting for Azure App Service and ...
Provides troubleshooting advice for the most common errors when hosting ASP.NET Core apps on Azure Apps Service and IIS.
Read more >
Azure linux app service + .netcore 3.1 application error
Hello, I developed .netcore 3.1 application and tried to deploy it using visual studio 2019. I've created app service in azure: 10182-11.png.
Read more >
Configure ASP.NET Core apps - Azure App Service
Learn how to configure a ASP.NET Core app in the native Windows instances, or in a pre-built Linux container, in Azure App Service....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found