lucacasonato / deno-puppeteer

A port of puppeteer running on Deno

Home Page:https://deno.land/x/puppeteer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PDF Issue on Chromium 91.0.4469.0 on Linux

JavaScriptDude opened this issue · comments

The latest version of this project points to Chromium 91.0.4469.0 and the instance I am using on linux fails with the following error when I try to call page.pdf({<opts>}):

error: Uncaught (in promise) Error: Protocol error (Page.printToPDF): PrintToPDF is not implemented
      this._callbacks.set(id, { resolve, reject, error: new Error(), method });
                                                        ^
    at https://deno.land/x/puppeteer@9.0.2/vendor/puppeteer-core/puppeteer/common/Connection.js:226:57
    at new Promise (<anonymous>)
    at CDPSession.send (https://deno.land/x/puppeteer@9.0.2/vendor/puppeteer-core/puppeteer/common/Connection.js:225:12)
    at Page.pdf (https://deno.land/x/puppeteer@9.0.2/vendor/puppeteer-core/puppeteer/common/Page.js:1406:39)

Here is my test code:

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

// Bad Version: Version 91.0.4469.0 (Developer Build) (64-bit)
const browser = await puppeteer.launch({headless: false});

// OK Version: Version 99.0.4844.74 (Official Build) (64-bit)
// const browser = await puppeteer.launch({executablePath: '/usr/bin/google-chrome', headless: false});
const page = await browser.newPage();
await page.goto("https://example.com");
await page.pdf({ path: "example.pdf" });

await browser.close();

This is an issue with Chromium and has been there for a long time and can be reproduced with other chromium remote engines (pyppeteer, selenium, ...).

The fix for the time being is to run with headless: true.

I have raised a ticket with Chromium.org.