willhlaw / node-firestore-backup-restore

Google Firebase Firestore backup and restore tool
91 stars 24 forks source link

Error: Argument "collectionPath" is not a valid ResourcePath. Path must be a non-empty string. #16

Open Pabloku opened 6 years ago

Pabloku commented 6 years ago

Hi! I need you help please

I was trying to restore a recent backup and I am getting this error:

Error: Argument "collectionPath" is not a valid ResourcePath. Path must be a non-empty string.
    at Object.exports.(anonymous function) [as isResourcePath] (C:\Users\Pablo\AppData\Roaming\npm\node_modules\firestore-backup-restore\node_modules\@google-cloud\firestore\src\validate.js:86:15)
    at Firestore.collection (C:\Users\Pablo\AppData\Roaming\npm\node_modules\firestore-backup-restore\node_modules\@google-cloud\firestore\src\index.js:296:14)
    at saveDocument (C:\Users\Pablo\AppData\Roaming\npm\node_modules\firestore-backup-restore\build\lib\FirestoreDocument.js:27:32)
    at C:\Users\Pablo\AppData\Roaming\npm\node_modules\firestore-backup-restore\build\index.js:211:63
    at Array.forEach (native)
    at restoreBackup (C:\Users\Pablo\AppData\Roaming\npm\node_modules\firestore-backup-restore\build\index.js:192:34)
    at C:\Users\Pablo\AppData\Roaming\npm\node_modules\firestore-backup-restore\build\index.js:197:28
    at Array.forEach (native)
    at restoreBackup (C:\Users\Pablo\AppData\Roaming\npm\node_modules\firestore-backup-restore\build\index.js:192:34)
    at Object.<anonymous> (C:\Users\Pablo\AppData\Roaming\npm\node_modules\firestore-backup-restore\build\index.js:239:21)

Am I doing anything wrong? firestore-backup-restore --backupPath myBackupPath --restoreAccountCredentials blablabla.json

Thanks

willhlaw commented 6 years ago

I'm not sure. It doesn't look like there is anything wrong from your command.

Only advice I have is to try a different firestore project; maybe it's an odd collection name that does not save well to the file system.

Or clone the repo and run devStart-debug --backupPath myBackupPath --restoreAccountCredentials blablabla.json. To debug, set debugger; statement before saveDocument call around line 321 in /lib/index.js, open chrome://inspect and click on Open Dedicated DevTools for Node and your running instance.

Let us know if you discover the cause!

Pabloku commented 6 years ago

I think I was trying something that was not supported: restore a backup from json backup... What I finally did was to backup and restore to/from a dummy firebase project that I am using as a "backup store"... But it would be nice to be able to backup/restore to/from a json backup. Thanks!

willhlaw commented 6 years ago

From a json backup? 🤔 Have you seen https://www.npmjs.com/package/node-firestore-import-export?