vikas5914 / google-photos-backup

Backup photos from Google Photos using Playwright.
MIT License
204 stars 20 forks source link

page.waitForURL: Timeout 30000ms exceeded. #11

Closed asthypar closed 5 months ago

asthypar commented 5 months ago

I am having some difficulty getting this to work. I'm providing the correct URL in the .lastdone file and have confirmed that the Chrome profile is correct (have run node index.js --headless=false and shows that it successfully authenticated into Google Photos).

The first photo downloads fine, and then hangs after the "Latest Photo" line before throwing a timeout error: -

~/google-photos-backup$ node index.js
Starting from: https://photos.google.com/photo/AF1QipM0H8WqvMFq2NT9UNbkuwWrvBRg6QwXtFmnvy8N
Latest Photo: https://photos.google.com/photo/AF1QipOzQucQaDuC0HtqYMhMt0Dc4zgoSZfGjGf_ZK-z
-------------------------------------
Download Complete: 1980/1/1385371089316.jpg
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

page.waitForURL: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for navigation until "load"
============================================================
    at file:///home/mat/google-photos-backup/index.js:85:16 {
  name: 'TimeoutError'
}

node -v shows version is v21.6.1

Also, running with --headless=false shows the file get downloaded, but then it doesn't move on to the next file, just stops and then times out.

asthypar commented 5 months ago

I may have managed to workaround this issue by increasing setting the timeout for page.waitForURL to a high value (300000). This is NOT the timeout that is already present in downloadPhoto. Instead I have made the following change:

    // we wait until new photo is loaded
    await page.waitForURL((url) => {
      return url.host === 'photos.google.com' && url.href !== currentUrl
    },
    {
      timeout: 300000,
    })

My downloads are now proceeding but I have a huge library, so not sure if I will encounter any more issues - I suspect that the timeout I was hitting was the result of a larger than usual library.

m1ndy commented 5 months ago

How large is your library? I have ~500k items so I would like to see if I might face the same issue

asthypar commented 5 months ago

I have around 250k items.

asthypar commented 5 months ago

Submitted pull request #12