Closed jbistis closed 6 years ago
Also tried... node import.js import-to-firestore.json Auth error:Error: invalid_grant: Invalid JWT Signature. { Error: Getting metadata from plugin failed with error: invalid_grant: Invalid JWT Signature. at /Users/jbistis/dev/firestore-importer/node_modules/google-gax/node_modules/grpc/src/client.js:554:15 code: 16, metadata: Metadata { _internal_repr: {} } } Auth error:Error: invalid_grant: Invalid JWT Signature. { Error: Getting metadata from plugin failed with error: invalid_grant: Invalid JWT Signature. at /Users/jbistis/dev/firestore-importer/node_modules/google-gax/node_modules/grpc/src/client.js:554:15 code: 16, metadata: Metadata { _internal_repr: {} } }
recreated data-transfer user....now getting... { Error: Missing or insufficient permissions. at /Users/jbistis/dev/firestore-importer/node_modules/google-gax/node_modules/grpc/src/client.js:554:15 code: 7, metadata: Metadata { _internal_repr: {} } } { Error: Missing or insufficient permissions. at /Users/jbistis/dev/firestore-importer/node_modules/google-gax/node_modules/grpc/src/client.js:554:15 code: 7, metadata: Metadata { _internal_repr: {} } }
Tried... { "countries": { "path": "/config/types/countries", "values": [{ "id": "AF", "name": "Afghanistan", "dialingCode": "+93" }, { "id": "AL", "name": "Albania", "dialingCode": "+355" }, { "id": "DZ", "name": "Algeria", "dialingCode": "+213" }, { "id": "ZW", "name": "Zimbabwe", "dialingCode": "+263" }] } }
Hi @jbistis , Look like you have some permission issue. Did you download the serviceAccount JSON file from Project Setting > SERVICE ACCOUNTS in your Firebase Console?
And replace the database URL in import.js file?
// You should replae databaseURL with your own
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://ionic-firestore-dn.firebaseio.com"
});
After that, you can try to run a test import with this file.
https://github.com/dalenguyen/firestore-import-export/blob/master/import-to-firestore.json
Thanks for that. It is working fine now when the file is of the format...
{
"countries" : {
"AF" : {
"id" : "AF",
"name" : "Afghanistan",
"dialingCode": "+93"
},
"AL" : {
"id" : "AL",
"name" : "Albania",
"dialingCode": "+355"
},
but when I try to load a file with the format that includes a path as follows, I get the error below:
{
"countries": {
"path": "/config/types/countries",
"values": [{
"id": "AF",
"name": "Afghanistan",
"dialingCode": "+93"
}, {
"id": "AL",
"name": "Albania",
"dialingCode": "+355"
}, {
"id": "ZW",
"name": "Zimbabwe",
"dialingCode": "+263"
}]
}
}
Error: Argument "data" is not a valid Document. Input is not a plain JavaScript object. Any idea how to get that to work?
Hi @jbistis , you should reconstruct your data before import to firestore. Make sure that you have document id properly.
In the first set of data, AF and AL are treated as document Id, and you should treat the other set of data similarly.
Hi @jbistis , Look like you have some permission issue. Did you download the serviceAccount JSON file from Project Setting > SERVICE ACCOUNTS in your Firebase Console?
And replace the database URL in import.js file?
// You should replae databaseURL with your own admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: "https://ionic-firestore-dn.firebaseio.com" });
After that, you can try to run a test import with this file.
https://github.com/dalenguyen/firestore-import-export/blob/master/import-to-firestore.json
Where can I find the import.js? I already downloaded my serviceAccount.json.
Hi @rupert2133, it's in the main directory. Or you can try this npm package: https://www.npmjs.com/package/firestore-export-import
Not sure what is wrong...file is of the form...
{ "countries": { "path": "/config/types/countries", "values": [{ "id": "AF", "name": "Afghanistan", "dialingCode": "+93" }, { "id": "AL", "name": "Albania", "dialingCode": "+355" }, { "id": "DZ", "name": "Algeria", "dialingCode": "+213" }, {