Open mflisikowski opened 1 year ago
Same here, same as #67
Probably it's worth waiting for https://github.com/denoland/deno/issues/18913 so we can use Puppeteer from npm
and have it always updated
I also have the same problem using Superbase edge functions and browserless
any updates on solving this issue?
Im also running into this error after calling page.pdf
on a supabase edge function. Would love to get updates
Was anyone able to solve this problem? I run into the same issue with Supabase Edge Functions.
@vinch in my use case I could solve the issue by replacing my puppeteer.launch()
call with a puppeteer.connect(...)
instead.
For that I had to launch a browserless io instance and connect puppeteer with it. Check browserless.io solution here.
Basically my code changed from
const browser = await puppeteer.launch();
const page = await browser.newPage();
to
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://chrome.browserless.io?token=${Deno.env.get("PUPPETEER_BROWSERLESS_IO_KEY")}`,
});
const page = await browser.newPage();
I dont know if that is actually an overkill, but I could solve my problem and the solution was very easy.
ps: Launching browserless instance was super easy (and for my usecase it was free)
@julianolm Yeah that's what I did as well but I didn't use Browserless (too expensive for me) but instead ran my own Puppeteer instance on DigitalOcean.
@vinch nailed it! Congrats
I was able to use Puppeteer
directly from NPM
using the following:
import * as Puppeteer from "npm:puppeteer";
const url = "https://example.com";
const BROWSER_PATH = "<path-to-chrome>/chrome";
const browser = await Puppeteer.launch({ headless: true, executablePath: BROWSER_PATH });
const page = await browser.newPage();
await page.goto(url, { waitUntil: "networkidle2" });
const pdf = await page.pdf({ format: "letter" });
await Deno.writeFile("output.pdf", pdf);
await page.screenshot({ path: "output.png" });
await browser.close();
It does produce a warning:
Warning: Not implemented: ClientRequest.options.createConnection
but, despite it, it does complete
Don't know how critical the warning is?
Deno info:
TypeError: reader is not async iterable
Supabase function code, that try to run.