puppeteer-sharp icon indicating copy to clipboard operation
puppeteer-sharp copied to clipboard

Puppeteer won't download latest version

Open devonuto opened this issue 3 years ago • 7 comments

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

devonuto avatar Jul 19 '22 22:07 devonuto

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 avatar Jul 19 '22 22:07 devonuto

@devonuto where are you running that?

kblok avatar Jul 19 '22 22:07 kblok

This is on my local machine debugging to find fault. Was working for years, stopped after updating to 7+

On Win 11.

devonuto avatar Jul 19 '22 22:07 devonuto

But is that a console app/web.desktop?

kblok avatar Jul 19 '22 23:07 kblok

Part of a webapi, hosted in IIS.

devonuto avatar Jul 19 '22 23:07 devonuto

@devonuto IIS can be problematic. I don't have a windows machine to debug this. PRs are welcome.

kblok avatar Jul 19 '22 23:07 kblok

@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"

ipoweb avatar Aug 16 '22 14:08 ipoweb

Set a custom path for your chromium download executable path. Like C:\XXX.

penguinawesome avatar Oct 10 '22 07:10 penguinawesome

As ConfigureAwat(false) fixes this, I won't invest in .NET Framework troubleshooting.

kblok avatar Oct 14 '22 13:10 kblok