kristianfreeman / roam-backup

Automated Roam Research backups using GitHub Actions and AWS S3
MIT License
82 stars 53 forks source link

Support multi-database accounts #4

Open Stvad opened 4 years ago

Stvad commented 4 years ago

See #1 on initial discussion

Stvad commented 4 years ago

So I have this snippet to get DB list

const getDatabases =
    async page => await page.$$eval(
        "#app > div:nth-child(1) > div > h4:nth-child(1) > a:nth-child(1)",
        nodes => nodes.map(n => n.innerText))

It works, and the rest of the script seems to as well, but at the end it fails as there is no zip file 🤔. Tried taking a screenshot, but it just shows main page of my db. Any advice @signalnerve

Stvad commented 4 years ago

Ok, tried on the other (smaller) DB, it worked, I guess I'll try increasing final timeout even higher...

Stvad commented 4 years ago

Yeah, that helped, but need to have timeout like 30 sec

Stvad commented 4 years ago

gonna publish a PR for multi-db support tomorrow-ish

jrykner commented 4 years ago

I'm getting timeout error at waiting for selector: { TimeoutError: waiting for selector ".bp3-popover-wrapper > .bp3-popover-target > div > .bp3-button > .bp3-button-text" failed: timeout 30000ms exceeded 21 at new WaitTask (/home/runner/work/roam-backup/roam-backup/node_modules/puppeteer/lib/DOMWorld.js:549:28) 22 at DOMWorld._waitForSelectorOrXPath (/home/runner/work/roam-backup/roam-backup/node_modules/puppeteer/lib/DOMWorld.js:478:22) 23 at DOMWorld.waitForSelector (/home/runner/work/roam-backup/roam-backup/node_modules/puppeteer/lib/DOMWorld.js:432:17) 24 at Frame.waitForSelector (/home/runner/work/roam-backup/roam-backup/node_modules/puppeteer/lib/FrameManager.js:627:47) 25 at Frame. (/home/runner/work/roam-backup/roam-backup/node_modules/puppeteer/lib/helper.js:112:23) 26 at Page.waitForSelector (/home/runner/work/roam-backup/roam-backup/node_modules/puppeteer/lib/Page.js:1122:29) 27 at downloadDatabase (/home/runner/work/roam-backup/roam-backup/index.js:43:14) 28 at process._tickCallback (internal/process/next_tick.js:68:7) name: 'TimeoutError' } 29 (node:3226) UnhandledPromiseRejectionWarning: Error: Couldn't find a file to upload, aborting

any idea how to solve this??

Stvad commented 4 years ago

do you have multiple databases? if so - you can use version from #6

otherwise - you can try increasing the relevant timeout (https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#pagewaitforselectorselector-options)

jrykner commented 4 years ago

do you have multiple databases? if so - you can use version from #6

otherwise - you can try increasing the relevant timeout (https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#pagewaitforselectorselector-options) yes I was using the multiple DB version, I increased the timeout as you suggested and now it works fine, thanks!

hopefully we can get a version that exports to Google Drive