lucacasonato/deno-puppeteer

`error: Uncaught (in promise) BadResource: Bad resource ID`

Opened this issue · 3 comments

Just tried to run the example code from README:

PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@14.1.1/install.ts

example.js / example.ts:

import puppeteer from "https://deno.land/x/puppeteer@14.1.1/mod.ts";

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://example.com");
await page.screenshot({ path: "example.png" });

await browser.close();

And then:

deno run -A --unstable example.ts

Which throws an error:

error: Uncaught (in promise) BadResource: Bad resource ID
    const result = await reader.read(inspectArr);
                   ^
    at async read (deno:runtime/js/12_io.js:105:19)
    at async readDelim (https://deno.land/std@0.93.0/io/bufio.ts:652:20)
    at async readStringDelim (https://deno.land/std@0.93.0/io/bufio.ts:702:20)
    at async readLines (https://deno.land/std@0.93.0/io/bufio.ts:711:18)
    at async waitForWSEndpoint (https://deno.land/x/puppeteer@14.1.1/src/deno/BrowserRunner.ts:167:20)
    at async BrowserRunner.setupConnection (https://deno.land/x/puppeteer@14.1.1/src/deno/BrowserRunner.ts:145:31)
    at async ChromeLauncher.launch (https://deno.land/x/puppeteer@14.1.1/src/deno/Launcher.ts:114:26)
    at async file:///home/ubuntu/Projects/deno-puppeteer/example.ts:3:17

Deno.version:

{ deno: "1.24.3", v8: "10.4.132.20", typescript: "4.7.4" }

denoland/deno#15479 maybe same as it

@rottenpen there's also this:

  • #17, - but although same error, this one definitely not related

It's hard to tell if it's related to denoland/deno#15479. Although in both cases it mentions some reader, but there it includes deno:core/01_core.js, while in this issue here it's related to deno:runtime/js/12_io.js.

Might be related. Might be not.

P.S. Although I like Deno, for now I'm more inclined to use original NodeJS puppeteer, as a more reliable piece of software. Unfortunately. Maybe in future release when there will be support for npm packages, this issue won't be even needed to be resolved.

@jerrygreen
did you find any solution for this issue?