profile
viewpoint

jontewks/genetic-route-planner 3

Genetic algorithm to plan the best possible route between many places

jontewks/indeed-firebase 1

Created to show someone how to query indeed for job data then store the responses in firebase

BuildingConnected/intercom-node 0

Node.js bindings for the Intercom API

jontewks/bc-slack-alerts 0

Send alerts to BC Slack

jontewks/bootstrap 0

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

startedtj/n

started time in 15 days

issue closedjontewks/puppeteer-heroku-buildpack

Geolocation API doesn't seem to be working

I'm using flags as recommended:

const browser = await puppeteer.launch({
        headless: true,
        args: [
            '--no-sandbox',
            '--disable-setuid-sandbox']
    })

Adding geolocation permissions:

const context = browser.defaultBrowserContext();
await context.overridePermissions(url, ['geolocation']);

Looks like it's granted as expected:

const granted = await page.evaluate(async () => {
        return (await navigator.permissions.query({ name: 'geolocation' })).state;
    });
console.log('Granted:', granted);

And finally setting location:

await page.setGeolocation({latitude, longitude});

But I can't get any response when trying to use browser geolocation API:

    page.on('console', msg => {
        for (let i = 0; i < msg.args().length; ++i)
            console.log(`${i}: ${msg.args()[i]}`);
    });


    await page.evaluate(() => {
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition((position) => {
                console.log(position.coords.latitude)
            })
        }
    });

Is this an buildpack issue? Local version works just fine.

closed time in a month

michal-boruczkowski

issue commentjontewks/puppeteer-heroku-buildpack

Geolocation API doesn't seem to be working

Hey there.

So the buildpack only gets chromium running on heroku, but doesn't change anything about how chromium works once its running. I took a peek and it looked like chromium won't allow any interaction with the geolocation API over http and requires a secure connection. If you don't have an SSL cert for your heroku app this might be why.

https://developers.google.com/web/updates/2016/04/geolocation-on-secure-contexts-only

michal-boruczkowski

comment created time in a month

issue commentjontewks/puppeteer-heroku-buildpack

Heroku : error while loading shared libraries: libX11-xcb.so.1, failed to launch chrome

@Ancinek have you come across this list yet? https://thoughtbot.com/blog/how-to-reduce-a-large-heroku-compiled-slug-size. Clearing the cache has helped me in the past

Nicolas-vrcc

comment created time in a month

issue closedjontewks/puppeteer-heroku-buildpack

PDF discrepancy when using page.emulateMediaType('screen')

I am attempting to create a PDF of my screen using

    const browser = await puppeteer.launch({
      headless: true,
      args: ['--no-sandbox', '--disable-setuid-sandbox']
    })
    console.log('browser has been opened')
    const page = await browser.newPage()
    page.setViewport({width: 1000, height: 1056})
    await page.waitFor(1000)
    await page.emulateMediaType('screen')
    await page.waitFor(5000)
    console.log('about to create PDF - standby')
    const pdf = await page.pdf({
      format: 'Letter',
      printBackground: true,
      path: MY PATH
    })
    console.log('pdf created')
    await browser.close()
    console.log('browser closed')
  }

Locally.. my PDF is returned to my browser with the proper sizing and formatting.. however. when running in production.. my formatting / margins are off..

This creates awkward page breaks in the middle of my content and is not suitable for my client!

I am using "puppeteer": "^2.00.0"

Does this buildpack effect await page.emulateMediaType('screen')?

  • if so.. has anyone been able to fix this issue?

Thanks in advance for your help!!!

closed time in 2 months

tmswartz12

issue commentjontewks/puppeteer-heroku-buildpack

PDF discrepancy when using page.emulateMediaType('screen')

Hey sorry for slow response, have been traveling for the holidays.

All this buildpack does is add some dependencies to the linux environment on heroku so that chromium can run correctly. All it does for puppeteer is allow chromium to start correctly, and shouldn't have any effect on how chromium acts or what it does after that.

This buildpack does still work for puppeteer versions 2 and greater as the main chromium dependencies didn't change. Sorry I can't help with the issue you are experiencing though. I'd guess you would get a much better response asking this question on the puppeteer github page as it sounds like mainly a usage issue and differences that shouldn't exist between headless true and false.

Good luck!

tmswartz12

comment created time in 2 months

issue closedjontewks/puppeteer-heroku-buildpack

disable buildpack after initial install

Is there a way to stop the buildpack from running every time I push new changes to production (on Heroku)?

Thanks in advance, Ian

closed time in 2 months

nax3t

issue commentjontewks/puppeteer-heroku-buildpack

disable buildpack after initial install

Hey @nax3t, there is some discussion about it found here: https://github.com/jontewks/puppeteer-heroku-buildpack/issues/51. As far as not getting the buildpacks to run when pushing code, I didn't see anything like that on heroku's site, and it seemed like it is set up to cause them to run each time. There may be some way of caching the installed packages, but a few things we tried didn't work and also heroku doesn't have that in their official chromium buildpack, and so it didn't make its way into this one.

Happy to accept a PR if you are inclined to find the way to cache on heroku correctly!

nax3t

comment created time in 2 months

issue closedjontewks/puppeteer-heroku-buildpack

Error: Failed to launch chrome!

2019-12-06T16:09:57.053282+00:00 app[web.1]: Error: Failed to launch chrome! 2019-12-06T16:09:57.053298+00:00 app[web.1]: 2019-12-06T16:09:57.053301+00:00 app[web.1]: (chrome:44): Gtk-WARNING **: 16:09:57.031: cannot open display: 2019-12-06T16:09:57.053303+00:00 app[web.1]: 2019-12-06T16:09:57.053305+00:00 app[web.1]: 2019-12-06T16:09:57.053308+00:00 app[web.1]: TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md 2019-12-06T16:09:57.053310+00:00 app[web.1]: 2019-12-06T16:09:57.053312+00:00 app[web.1]: at onClose (/app/node_modules/puppeteer/lib/Launcher.js:348:14) 2019-12-06T16:09:57.053314+00:00 app[web.1]: at ChildProcess.<anonymous> (/app/node_modules/puppeteer/lib/Launcher.js:338:60) 2019-12-06T16:09:57.053317+00:00 app[web.1]: at ChildProcess.emit (events.js:215:7) 2019-12-06T16:09:57.053319+00:00 app[web.1]: at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) 2019-12-06T16:10:26.921203+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/product/new?search=https%3A%2F%2Fwww.walmart.com%2Fip%2FHamilton-Beach-Set-n-Forget-6-Quart-Slow-Cooker-Model-33969%2F16913518" host=arcane-wave-04024.herokuapp.com request_id=34a979c5-a553-4ba2-b233-af91b577d74a fwd="124.29.252.211" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https

I got this error. I have already setup following: puppeteer.launch({ args: ['--no-sandbox'] });

Added: https://github.com/jontewks/puppeteer-heroku-buildpack to Buildpacks.

Can any one help me out in this. Code was working fine on local host. But when I deploy it on heroku, it gives this error constantly.

closed time in 3 months

ghulamabbas258

issue commentjontewks/puppeteer-heroku-buildpack

Error: Failed to launch chrome!

Yes headless: false breaks heroku as it doesn't have a GUI to show you anything. Remove that from your launch options and you should be good to go.

ghulamabbas258

comment created time in 3 months

issue commentjontewks/puppeteer-heroku-buildpack

Error: Failed to launch chrome!

@ghulamabbas258 would you mind posting your full code if possible as well as the full error message? Also the contents of your package.json could be helpful.

Do you have headless: false in your puppeteer launch options too? I see a warning about chrome unable to open a display which would definitely break heroku.

Also this seems to fix random issues people have run into so its always worth a shot: https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache

ghulamabbas258

comment created time in 3 months

push eventjontewks/advent-of-code-2019

Jon Tewksbury

commit sha 305f5197e55f3b1477cb58e88e2180f7271928ac

Complete day 2

view details

push time in 3 months

push eventjontewks/advent-of-code-2019

Jon Tewksbury

commit sha 6118d7b851399a5c3df43f2454d4967c36bedeaf

Complete day 2

view details

push time in 3 months

push eventjontewks/advent-of-code-2019

Jon Tewksbury

commit sha 7c99c5c03f5bf961b588d0dbb78f143cd705f2d1

day 2 part 1

view details

push time in 3 months

create barnchjontewks/advent-of-code-2019

branch : master

created branch time in 3 months

created repositoryjontewks/advent-of-code-2019

created time in 3 months

issue closedjontewks/puppeteer-heroku-buildpack

"Chromium revision is not downloaded" Error

Hi! When I'm trying to use the buildpack on heroku, I'm seeing the following error message:

Error: Unable to launch browser for worker, error message: 
Chromium revision is not downloaded. Run "npm install" or "yarn install"

I'm using puppeteer-cluster which calls into puppeteer with the --no-sandbox argument as suggested in this buildpack's readme. Has anyone else run into this issue or know what could be going on?

  const cluster = await Cluster.launch({
    monitor: true,
    concurrency: Cluster.CONCURRENCY_BROWSER,
    // see https://devcenter.heroku.com/articles/node-concurrency
    maxConcurrency: WEB_CONCURRENCY ? +WEB_CONCURRENCY : 5,
    // see https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md#puppeteerlaunchoptions
    puppeteerOptions: {
      // see https://peter.sh/experiments/chromium-command-line-switches/
      args: ['--no-sandbox'],
    },
  });
$ grep -i \"version\" ../../node_modules/puppeteer/package.json 
  "version": "1.15.0",
$ grep -i \"version\" ../../node_modules/puppeteer-cluster/package.json 
  "version": "0.17.0",

closed time in 3 months

blaskovicz

issue commentjontewks/puppeteer-heroku-buildpack

"Chromium revision is not downloaded" Error

I can only venture some guesses here as I've never dealt with this issue.

Is your lockfile being sent to heroku when its being pushed? It isn't part of your .gitignore correct?

I've run into weird issues in the past with caching problems, so clearing your build cache is at least worth a shot: https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache

Since this issue doesn't have to do with the buildpack itself, as all that is supposed to help with is getting Puppeteer running on heroku, I'm going to close the issue, but still happy to talk through it or throw out more random guesses as you try new things. Good luck!

blaskovicz

comment created time in 3 months

issue commentjontewks/puppeteer-heroku-buildpack

"Chromium revision is not downloaded" Error

Haven't seen it before. Is your code running ok locally?

blaskovicz

comment created time in 3 months

issue closedjontewks/puppeteer-heroku-buildpack

Where to define the `--no-sandbox` argument?

Sorry for the simple question but I'm not clear on these instructions:

Be sure to include { args: ['--no-sandbox'] } in your call to puppeteer.launch

Where am I supposed to call puppeteer.launch from and where am I supposed to add the arguments?

Thanks.

closed time in 4 months

lee-40square

issue commentjontewks/puppeteer-heroku-buildpack

Where to define the `--no-sandbox` argument?

Hey @lee-40square, no worries.

Here is an example of a basic use case of puppeteer and how you'd call that function: https://github.com/GoogleChrome/puppeteer#usage

Basically in order to use puppeteer for its intended purpose you'd have to call that function to get the ball rolling. Here is the full docs for that function and the arguments it takes: https://github.com/GoogleChrome/puppeteer/blob/v2.0.0/docs/api.md#puppeteerlaunchoptions

lee-40square

comment created time in 4 months

pull request commentjontewks/puppeteer-heroku-buildpack

The dependencies are updated to the latest requiremernts

@joey2031 yeah that should be it and no problem at all. Good luck!

mataspetrikas

comment created time in 4 months

pull request commentjontewks/puppeteer-heroku-buildpack

The dependencies are updated to the latest requiremernts

Cool. The console log will show up in the application logs which you can see in heroku's UI, and web vs worker shouldn't change dependencies available to either dyno type but if you are curious you could always swap it from web back to worker to verify. We have our puppeteer running on worker dynos so they aren't subject to the 30 second timeout that web dynos are. Either way glad its working now!

mataspetrikas

comment created time in 4 months

pull request commentjontewks/puppeteer-heroku-buildpack

The dependencies are updated to the latest requiremernts

@joey2031 maybe try creating a new heroku app on heroku-18 and deploying fresh? With the above code I'm able to get it working right away. It must be some weird cache issue or something along those lines, as that was the cause of that other person running into the same error and since the same code is working elsewhere. LMK if you are able to try that out.

mataspetrikas

comment created time in 4 months

pull request commentjontewks/puppeteer-heroku-buildpack

The dependencies are updated to the latest requiremernts

Launching chrome usually isn't related to the content of the file, but its possible. Can you try it with just the following as the entire contents of the bot.js file?

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ args: ['--no-sandbox'] })
  const page = await browser.newPage()
  await page.goto('https://www.buildingconnected.com')

  console.log('WORKING')

  await browser.close()
  process.exit(0)
})()
mataspetrikas

comment created time in 4 months

pull request commentjontewks/puppeteer-heroku-buildpack

The dependencies are updated to the latest requiremernts

Thanks for trying. My next best guesses would be to start upgrading some things and see if we can resolve it. I noticed the version of puppeteer you are using requests at least node 8.9.0+ but you're using 8.2.1. I doubt thats the issue but I've been surprised before. Maybe worth upgrading your node version, at least to the latest LTS version.

Also I'd try clicking the upgrade stack button from your screenshot to get heroku-18, as they all have separate dependencies that might help resolve the issue.

mataspetrikas

comment created time in 4 months

pull request commentjontewks/puppeteer-heroku-buildpack

The dependencies are updated to the latest requiremernts

Thanks for that extra info. Everything there looks good. Its an exact match for this issue: https://github.com/jontewks/puppeteer-heroku-buildpack/issues/14 so that might be a good place to start. That person was able to resolve the issue by clearing their build cache, instructions here: https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache

Give that a shot and let me know what happens.

mataspetrikas

comment created time in 4 months

issue commentGoogleChrome/puppeteer

Issue with deploying puppeteer on heroku (with resolution)

@joey2031 not that I'm aware of. I've responded to you in the issue you commented on on my buildpack, so lets talk there rather than on a Puppeteer issue.

jontewks

comment created time in 4 months

pull request commentjontewks/puppeteer-heroku-buildpack

The dependencies are updated to the latest requiremernts

@joey2031 can you post your heroku buildpack list, which heroku stack you are using, and package.json contents so we can take a look?

mataspetrikas

comment created time in 4 months

push eventjontewks/puppeteer-heroku-buildpack

Aziz Yokubjonov

commit sha 79980089b437600d84137da545e7bbc3b90a3737

Add buildpack non-destructively (#53)

view details

push time in 5 months

PR merged jontewks/puppeteer-heroku-buildpack

Add the buildpack non-destructively

It's an awesome repo you have and certainly saved my day using Puppeteer along with Heroku!

However, when reading the Readme, I used the command in the usage guide, which overwrote my default heroku/nodejs builder in the project, causing my project to stop building.

In this PR I propose guiding users to instead add the buildpack without replacing whatever buildpacks they currently have.

+2 -2

1 comment

1 changed file

aziz512

pr closed time in 5 months

pull request commentjontewks/puppeteer-heroku-buildpack

Add the buildpack non-destructively

Hey! Thanks a lot! Never noticed that before somehow.

aziz512

comment created time in 5 months

issue closedjontewks/puppeteer-heroku-buildpack

Error: Evaluation failed: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at puppeteer_evaluation_script:4:25

Hi!

I am encountering this issue on heroku-18.

Error: Evaluation failed: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at puppeteer_evaluation_script:4:25

The code works fine on localhost. Any ideas?

closed time in 5 months

causztic

issue commentjontewks/puppeteer-heroku-buildpack

Error: Evaluation failed: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at puppeteer_evaluation_script:4:25

Thanks for the extra info. I haven't seen this particular error before, mainly because this buildpack is to get Puppeteer running on Heroku only and doesn't have anything to do with it after its running.

I can't say for sure why its working locally but not on heroku other than different data showing up in the page locally vs herokuly. The error says it can't iterate over something, and the only iteration I see in the code is edges.slice(0, postCount).forEach. Perhaps store the result of the slice in a variable and log it before calling forEach so you can verify its what you expect? Beyond that I don't have any other ideas other than needing to go through the standard debugging process. Sometimes it can be helpful to take screenshots of what Puppeteer is seeing as well and verifying its what you expect.

Hope you figure it out! Feel free to ask any other questions here, but I'm going to close it as it isn't an issue with the buildpack per se.

causztic

comment created time in 5 months

issue commentjontewks/puppeteer-heroku-buildpack

Error: Evaluation failed: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at puppeteer_evaluation_script:4:25

Is this during deploy? Or after deploy and puppeteer is running? Any other output or indication puppeteer is running before this? Also can you post your package.json and the relevant code that is being run if possible?

causztic

comment created time in 5 months

more