Puppeteer Waiting for target frame Ubuntu digitalocean

Viewed 345

I have been building a webscraper in Node.js and running it on a digital ocean Ubuntu server. Puppeteer is only having issues on Ubuntu for my program.

I originally had an issue running Puppeteer with root user so I switched to a new account I made on the server and now I have this new issue.

Version: HeadlessChrome/105.0.5173.0

Error: Waiting for target frame D0E4A57B880331E15F232D467A28499A failed at Timeout._onTimeout (/home/pricepal/priceServer-deployment/price-server/node_modules/puppeteer/lib/cjs/puppeteer/common/util.js:447:18) at listOnTimeout (node:internal/timers:564:17) at process.processTimers (node:internal/timers:507:7)

Node.js v18.7.0

Here is the block of code that the program stops at and eventually errors out:

try {
        const browser = await puppeteer.launch()
        const page = await browser.newPage()
        await page.goto(link)
        const content = await page.content()
        await browser.close()
        return content
    } catch (error) {
        console.log(error)
    }

It takes a little longer than normal to generate the headless browser but the error is stemming from a timeout happening at page.goto(link). All of the links fail to load not just one in particular.

The links I am using work when ran on my m1 mac with the same chromium and node versions.

I have been doing research and trying new things all day but I cannot get it fixed and have found little resourced relating to this issue.

1 Answers

I had the exact same problem, been pulling my hair out looking for answers the past few days. I know it's not exactly a proper answer (mods sorry if you have to delete this), but I found that switching from Ubuntu to Debian 10 magically fixed everything. FWIW the line causing the error is:

const page = await browser.newPage()

I suspect the issue lies somewhere within the version of Chromium that Puppeteer downloads, and its interaction with the OS. What exactly though I couldn't say. My results are as follows:

Didn't work:

  • Ubuntu 22.04
  • Ubuntu 20.04
  • Debian 11

Worked:

  • Debian 10
Related