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

Error when saving output of page.pdf into variable #67

Open
TBolokhov opened this issue Oct 26, 2022 · 0 comments
Open

Error when saving output of page.pdf into variable #67

TBolokhov opened this issue Oct 26, 2022 · 0 comments

Comments

@TBolokhov
Copy link

TBolokhov commented Oct 26, 2022

The following code which outputs page.pdf into variable

#!/usr/bin/env -S deno -q run -A --unstable
import puppeteer from "https://deno.land/x/puppeteer/mod.ts";

const browser = await puppeteer.launch()
const page = await browser.newPage();

const html = "<html></html>";
await page.goto("data:text/html," + html, {
  waitUntil: 'networkidle2'
});

const pdf = await page.pdf({
  format: 'A4',
})

await browser.close()

fails in Deno Puppeteer versions 16.2.0 and 14.1.1, but works in the version 9.0.2. The error is as follows

error: Uncaught TypeError: reader is not async iterable
  for await (const chunk of reader) {
                            ^
    at getReadableStreamAsUint8Array (https://deno.land/x/puppeteer@16.2.0/vendor/puppeteer-core/puppeteer/common/util.js:329:29)
    at Page.pdf (https://deno.land/x/puppeteer@16.2.0/vendor/puppeteer-core/puppeteer/common/Page.js:2606:24)
    at async file:///home/dir/test.ts:12:13

This error is also absent in newer versions of Puppeteer, f.e. 19.x.x.

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

1 participant