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

Windows: Error: Error: Page crashed #10

Closed
Ciantic opened this issue May 1, 2018 · 5 comments
Closed

Windows: Error: Error: Page crashed #10

Ciantic opened this issue May 1, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@Ciantic
Copy link

Ciantic commented May 1, 2018

Installation worked fine, but it does not seem to work.

I have isolated the problem to PDF creation:

  await page.pdf(options)

Is causing issue on my system somehow.

I cloned the book example and modified a file:

PS C:\Source\JavaScript\ReLaXed-toc-tests> relaxed book.pug
Watching book.pug and its directory tree.

Processing detected change in \book.pug...
Error: Page crashed!
    at Page._onTargetCrashed (C:\Copies\ReLaXedJs\node_modules\puppeteer\lib\Page.js:118:24)
    at CDPSession.Page.client.on.event (C:\Copies\ReLaXedJs\node_modules\puppeteer\lib\Page.js:104:56)
    at CDPSession.emit (events.js:180:13)
    at CDPSession._onMessage (C:\Copies\ReLaXedJs\node_modules\puppeteer\lib\Connection.js:219:12)
    at Connection._onMessage (C:\Copies\ReLaXedJs\node_modules\puppeteer\lib\Connection.js:119:19)
    at WebSocket.emit (events.js:180:13)
    at Receiver._receiver.onmessage (C:\Copies\ReLaXedJs\node_modules\ws\lib\WebSocket.js:141:47)
    at Receiver.dataMessage (C:\Copies\ReLaXedJs\node_modules\ws\lib\Receiver.js:389:14)
    at Receiver.getData (C:\Copies\ReLaXedJs\node_modules\ws\lib\Receiver.js:330:12)
    at Receiver.startLoop (C:\Copies\ReLaXedJs\node_modules\ws\lib\Receiver.js:165:16)
Error: Error: Page crashed!

I hit Ctrl+C

(node:11184) UnhandledPromiseRejectionWarning: Error: Protocol error (Page.printToPDF): Target closed.
    at Promise (C:\Copies\ReLaXedJs\node_modules\puppeteer\lib\Connection.js:200:56)
    at new Promise (<anonymous>)
    at CDPSession.send (C:\Copies\ReLaXedJs\node_modules\puppeteer\lib\Connection.js:199:12)
    at Page.pdf (C:\Copies\ReLaXedJs\node_modules\puppeteer\lib\Page.js:782:39)
    at Object.exports.masterDocumentToPDF (C:\Copies\ReLaXedJs\src\converters.js:192:14)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
(node:11184) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11184) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Installation transcript, which I think means it installed correctly:

PS C:\Copies\ReLaXedJs> git clone https://github.com/RelaxedJS/ReLaXed.git .
Cloning into '.'...
remote: Counting objects: 133, done.
remote: Compressing objects: 100% (110/110), done.
remote: Total 133 (delta 74), reused 54 (delta 21), pack-reused 0
Receiving objects: 100% (133/133), 225.90 KiB | 0 bytes/s, done.
Resolving deltas: 100% (74/74), done.
PS C:\Copies\ReLaXedJs> npm install
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0

> node-sass@4.9.0 install C:\Copies\ReLaXedJs\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.0/win32-x64-59_binding.node
Download complete .] - :
Binary saved to C:\Copies\ReLaXedJs\node_modules\node-sass\vendor\win32-x64-59\binding.node
Caching binary to C:\Users\jarppa2\AppData\Roaming\npm-cache\node-sass\4.9.0\win32-x64-59_binding.node

> puppeteer@1.3.0 install C:\Copies\ReLaXedJs\node_modules\puppeteer
> node install.js

Downloading Chromium r549031 - 122.5 Mb [====================] 100% 0.0s
Chromium downloaded to C:\Copies\ReLaXedJs\node_modules\puppeteer\.local-chromium\win64-549031

> node-sass@4.9.0 postinstall C:\Copies\ReLaXedJs\node_modules\node-sass
> node scripts/build.js

Binary found at C:\Copies\ReLaXedJs\node_modules\node-sass\vendor\win32-x64-59\binding.node
Testing binary
Binary is fine
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN relaxedjs@0.1.2 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1052 packages in 87.302s
PS C:\Copies\ReLaXedJs> npm link --unsafe-perm=true
npm WARN relaxedjs@0.1.2 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

up to date in 8.597s
C:\Copies\Node\relaxed -> C:\Copies\Node\node_modules\relaxedjs\src\index.js
C:\Copies\Node\node_modules\relaxedjs -> C:\Copies\ReLaXedJs

PS. I modified the error to show the first stack trace.

@Zulko
Copy link
Member

Zulko commented May 1, 2018

Does it work for the original example ?

@Ciantic
Copy link
Author

Ciantic commented May 1, 2018

What is original example?

But I found out if I comment out this:

  var options = {
    path: outputPath,
    // displayHeaderFooter: headerTemplate || footerTemplate,
    headerTemplate,
    footerTemplate,
    printBackground: true
  }

It works again.

Not sure why displayHeaderFooter makes it crash.

@Ciantic
Copy link
Author

Ciantic commented May 1, 2018

oh sorry, yes, the example is original, I only add and remove a one letter in it to make it try the compilation.

@Zulko Zulko added the bug Something isn't working label May 1, 2018
@Zulko
Copy link
Member

Zulko commented May 5, 2018

Thanks for the report. It turns out that in puppeteer >1.0.0 the PDF rendering crashes if the header or footer has some CSS which imports a font. Not sure why or if it is a more generic problem. The example is now fixed, but the footer font is now Helvetica instead of being a cool google font :(

@Zulko Zulko closed this as completed May 5, 2018
@DanielRuf
Copy link
Contributor

Thanks for the report. It turns out that in puppeteer >1.0.0 the PDF rendering crashes if the header or footer has some CSS which imports a font. Not sure why or if it is a more generic problem. The example is now fixed, but the footer font is now Helvetica instead of being a cool google font

Sounds like a promise / remote content related issue.
Google fonts can also be used / hosted offline, see
https://github.com/majodev/google-webfonts-helper
https://google-webfonts-helper.herokuapp.com/fonts
https://github.com/DanielRuf/google-webfonts-downloader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants