LaunchAsync failed on Azure as a Windows/Linux .net core 5 App service
See original GitHub issueMy 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:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top GitHub Comments
Closed due to inactivity. Feel free to reopen it if needed.
OKay, thanks for your time. I guess I’ll also have to move to some option other than puppeteer.