Puppeteer web scraper unable to find selectors when deployed to Heroku

Viewed 115

I have this issue where my code is working locally without any issues, but once deployed to heroku it is unable to find selectors. Example is one of my methods that perform filter select on a page.

async selectFilterOptions( { server, skillFilter, skillMinValue }) {
    try {
      await this.page.select("select[name='world']", server);
      await this.page.select("select[name='skillId']", skillFilter);
      await this.page.$eval("input[name='rangefrom']", (el, skillMinValue) => el.value = skillMinValue, skillMinValue);
      
      await this.page.click("input[name='Filter']");
      await this.page.waitForSelector(".mainContainer");

    } catch (error) {
      console.log(error.message)
    }
  }

As previously said this code works with no issue when I run it locally, but when it runs on Heroku I am getting error logs (it always fails on the first selector that it attempt to find):

2020-09-01T17:38:20.661482+00:00 app[web.1]: No node found for selector: select[name='world']
2020-09-01T17:38:20.668330+00:00 app[web.1]: No node found for selector: select[name='world']
2020-09-01T17:38:40.000000+00:00 app[api]: Build succeeded
2020-09-01T17:39:17.234375+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-09-01T17:39:17.248576+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-01T17:39:17.320779+00:00 heroku[web.1]: Process exited with status 137

I have already installed puppeteer-heroku-buildpack and also specified launch options:

const browser = await puppeteer.launch({
      args: [
        '--no-sandbox',
        '--disable-setuid-sandbox'
      ],
    });
0 Answers
Related