Using headless-chrome / Chromeless with Meteor for PDF generation


I’m working on a project that requires PDF generation, and in terms of getting a sharp look, nothing does it better than Chrome.

We are looking into using headless-chrome or Chromeless inside the Meteor application. Does anyone have any experience with this?

In particular - I am trying to understand how this would work in terms of deploying to a managed deployment platform like Galaxy or Heroku.


Haven’t tried it in a Meteor env yet, but in a standard nodejs/express env.
I would just install and use it on the server to create PDFs and either stream them to the client or just save it on the server and open it via a server route. Shouldn’t be too hard I guess or maybe I am missing something …


I think so too. Do you know if Puppeteer requires you to install Chrome on the server?


Nope, just install puppeteer and you are pretty much good to go.


FYI - puppeteer is awesome, and works great locally - but - Galaxy has trouble running it inside Docker containers. I don’t have a solution for this, just mentioning it for those looking into the same problem.


Hey, I was wondering how you managed to get puppeteer working with Meteor? I am getting the following error:

(node:56561) UnhandledPromiseRejectionWarning: TypeError: puppeteer.launch is not a function

Btw, I am trying to use puppeteer from a Meteor method like so:

import { Meteor } from 'meteor/meteor'
import puppeteer from 'puppeteer'

  async puppetTest() {
    const browser = await puppeteer.launch()
    const page = await browser.newPage()
    await page.goto('')
    await page.screenshot({path: 'test.png'})
    await browser.close()

For some reason puppeteer returns {} rather than [Function]

The issue was solved.


Hi, could you please indicate how did you solve that issue?
I’m starting a migration of a project using Nightmare.js to Puppeteer and I having the same issue in meteor. In node.js works fine.


Hey, hard reset of the project helped i.e., meteor reset. Also, make sure you install puppeteer, like so meteor npm install --save puppeteer. Then, simply use it in an async method on your server.


I’m trying to use Puppeteer / headless Chrome in a METEOR@1.6.1 project.
I’ve installed puppeteer using:
meteor npm install --save puppeteer
When I run my app, after 30 seconds it crashes with this error:
(node:13927) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Navigation Timeout Exceeded: 30000ms exceeded
I have not run any Puppeteer script. All I have done is install Puppeteer and run my app as usual. So it seems Puppeteer has completely broken my app!
Has anybody seen a similar problem or got any ideas? I have googled for this error and it seems to be common but always after you have run a .js script, which I have not done.


Ah, I think I’ve figured out what I did wrong.

I created a file example.js as per the Puppeteer documentation, with some code to run in Puppeteer. And I saved it in the root of my Meteor project. So of course Meteor automatically ran it - before the app had launched and the page rendered.

Moving my example.js into the /tests folder solved the problem: the file now does not execute until I run it manually.

Leaving this up here in case anybody else makes the same simple mistake and this post can save them some time.