puppeteer-sharp
puppeteer-sharp copied to clipboard
Puppeteer won't download latest version
Description
Latest version of puppeteer not downloading. I have a basic method that calls to download the latest version, but it gets to await fetcher.CanDownloadAsync(BrowserFetcher.DefaultChromiumRevision) and hangs. Nothing else happens.
Complete minimal example reproducing the issue
/// <summary>
/// Downloads the latest headless Chromium if it doesn't exist.
/// </summary>
/// <returns></returns>
public async Task GetBrowser()
{
try
{
BrowserFetcher fetcher = new();
IEnumerable<string> available = fetcher.LocalRevisions();
if (!available.Contains(BrowserFetcher.DefaultChromiumRevision))
{
_main.LogInfo(nameof(GetBrowser), $"Downloading Chromium (Revision: {BrowserFetcher.DefaultChromiumRevision})");
if (await fetcher.CanDownloadAsync(BrowserFetcher.DefaultChromiumRevision))
{
await fetcher.DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
}
else
{
await _main.LogError(nameof(GetBrowser), $"Unable to download Chromium Revision: {BrowserFetcher.DefaultChromiumRevision}");
}
}
}
catch (Exception ex)
{
await _main.LogError(nameof(GetBrowser), ex.Message);
}
}
Expected behavior:
Revision to download
Actual behavior:
Hangs and no errors thrown
Versions
7.1.0 dotnet 6.0.7
Okay, adding ConfigureAwat(false) to the end of both await calls to "candownload", and download seems to have fixed it. But this is still a bug. People shouldn't need to do that.
@devonuto where are you running that?
This is on my local machine debugging to find fault. Was working for years, stopped after updating to 7+
On Win 11.
But is that a console app/web.desktop?
Part of a webapi, hosted in IIS.
@devonuto IIS can be problematic. I don't have a windows machine to debug this. PRs are welcome.
@kblok
You can enable IIS on Windows 10 or Virtual Machine with free iso https://www.itechtics.com/windows-10-download-iso/
You need to enable Windows Features IIS and it's free
@devonuto You can change Rights on Pool application (Net v4.5 or classic) and used identified user account as administrator and change Permission, and after on default web site on "basic parameters"
Set a custom path for your chromium download executable path. Like C:\XXX.
As ConfigureAwat(false) fixes this, I won't invest in .NET Framework troubleshooting.