lucacasonato / deno-puppeteer

A port of puppeteer running on Deno
https://deno.land/x/puppeteer
MIT License
454 stars 44 forks source link

`page.pdf()` does not resolve #53

Closed milotheirself closed 2 years ago

milotheirself commented 2 years ago

When I run the hackernews.ts example –

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://news.ycombinator.com", { waitUntil: "networkidle2" });

console.log('before');
await page.pdf({ path: "hn.pdf", format: "a4" });
console.log('after');

await browser.close();

a file at ./hn.pdf is created, but it appears to be empty, and await page.pdf({ path: './example.pdf' }); never resolves. There are no error message, and the default timeout after 30 seconds also does not occur.

The same code setup does work on my system in NodeJS with Puppeteer v14.1.1 and Chromium 991974, but #4136 in the Puppeteer issues describes something similar, that seems to have been fixed by version 1.13.0.

milotheirself commented 2 years ago

I reverted to puppeteer@9.0.2 with Chromium 869685, which works now.

If anyone knows what may be causing the PDF issue, please let me know! ^^

ferk6a commented 2 years ago

Also experiencing the same issue, had to downgrade to 9.0.2. But do keep in mind that jspm.io now crashes in this project returning 500, so I had to apply https://github.com/lucacasonato/deno-puppeteer/pull/58 separately.

milotheirself commented 2 years ago

@fer22f, what version did you use before downgradeing? I am still not sure what caused the PDF issue I was having in @14.1.1, but the same code example is currently working fine for me in @16.2.0.

ferk6a commented 2 years ago

I was on 16.2.0, but it had another issue relating to being impossible to extract the PDF using the stream API. I started work on it via https://github.com/fer22f/deno-puppeteer/commit/7df9d6a6fa4605ca25fec47ac0ffc7dff3c6172b, but the PDF generation appeared stuck.