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

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

Open jerrygreen opened this issue 3 years ago • 3 comments

Just tried to run the example code from README:

PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/[email protected]/install.ts

example.js / example.ts:

import puppeteer from "https://deno.land/x/[email protected]/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/[email protected]/io/bufio.ts:652:20)
    at async readStringDelim (https://deno.land/[email protected]/io/bufio.ts:702:20)
    at async readLines (https://deno.land/[email protected]/io/bufio.ts:711:18)
    at async waitForWSEndpoint (https://deno.land/x/[email protected]/src/deno/BrowserRunner.ts:167:20)
    at async BrowserRunner.setupConnection (https://deno.land/x/[email protected]/src/deno/BrowserRunner.ts:145:31)
    at async ChromeLauncher.launch (https://deno.land/x/[email protected]/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" }

jerrygreen avatar Aug 23 '22 17:08 jerrygreen

https://github.com/denoland/deno/issues/15479 maybe same as it

rottenpen avatar Aug 26 '22 01:08 rottenpen

@rottenpen there's also this:

  • https://github.com/lucacasonato/deno-puppeteer/issues/17, - but although same error, this one definitely not related

It's hard to tell if it's related to https://github.com/denoland/deno/issues/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 avatar Aug 27 '22 13:08 jerrygreen