Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Windows: deno stays idle for some seconds after using puppeteer #20360

Closed
c-antin opened this issue Sep 2, 2023 · 2 comments
Closed

Bug: Windows: deno stays idle for some seconds after using puppeteer #20360

c-antin opened this issue Sep 2, 2023 · 2 comments

Comments

@c-antin
Copy link

c-antin commented Sep 2, 2023

When testing puppeteer with deno on Windows 10, I noticed that the deno.exe stays idle for some seconds.

Code to reproduce:

import puppeteer from "npm:[email protected]";

//deno run --allow-read --allow-env --allow-write=./temp,./export --allow-run --allow-net=127.0.0.1 --node-modules-dir=false main.ts

console.time("pdf");
// deno-lint-ignore no-explicit-any
(puppeteer as any).configuration = { temporaryDirectory: "./temp" };

const browser = await puppeteer.launch({
  executablePath: String
    .raw`C:\Program Files\Google\Chrome\Application\chrome.exe`,
  handleSIGHUP: false,
});
const page = await browser.newPage();

await page.goto("https://news.ycombinator.com", {
  waitUntil: "networkidle2",
});
// page.pdf() is currently supported only in headless mode.
// @see https://bugs.chromium.org/p/chromium/issues/detail?id=753118
const buffer = await page.pdf({
  format: "letter",
});
await Deno.writeFile("./export/hn.pdf", buffer);

await browser.close();
console.timeEnd("pdf");
// Deno.exit(0); //required because deno stays idle for some seconds

Expected behavior: the process should exit immediately after awaiting browser.close();.

A similar node script behaves as expected:

import puppeteer from 'puppeteer-core';

//node main.mjs

(async () => {
    console.time("pdf");

    puppeteer.configuration = { temporaryDirectory: "./temp" };

    const browser = await puppeteer.launch({
        executablePath: String
            .raw`C:\Program Files\Google\Chrome\Application\chrome.exe`,
        handleSIGHUP: false,
    });
    const page = await browser.newPage();

    await page.goto("https://news.ycombinator.com", {
        waitUntil: "networkidle2",
    });
    // page.pdf() is currently supported only in headless mode.
    // @see https://bugs.chromium.org/p/chromium/issues/detail?id=753118
    await page.pdf({
        path: "./export/hn_node.pdf",
        format: "letter",
    });

    await browser.close();
    console.timeEnd("pdf");
})();
@guillaume86
Copy link

Yes there's a 30 sec timeout, same issue as #20179

@kt3k
Copy link
Member

kt3k commented Sep 17, 2024

This should be fixed by #25387

The fix is available in 2.0.0-rc.2 or above. You can upgrade to RC by the command:

deno upgrade
deno upgrade rc

@kt3k kt3k closed this as completed Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants