我正在尝试使用这里的说明设置我的Firestore的自动备份:https://firebase.google.com/docs/firestore/solutions/schedule-export
我得到错误:
firestoreExpert
g2o6pmdwatdp
TypeError: Cannot read properties of undefined (reading 'charCodeAt')
at peg$parsetemplate (/workspace/node_modules/google-gax/build/src/pathTemplateParser.js:304:17)
at Object.peg$parse [as parse] (/workspace/node_modules/google-gax/build/src/pathTemplateParser.js:633:18)
at new PathTemplate (/workspace/node_modules/google-gax/build/src/pathTemplate.js:55:54)
有什么调试建议吗?
我尝试查找权限中的错误。例如,虽然GCL运行正常,但我不知道如何检查服务是否有权访问特定存储桶。我还尝试查找脚本中的错误。index.js
const firestore = require('@google-cloud/firestore');
const client = new firestore.v1.FirestoreAdminClient();
// Replace BUCKET_NAME
const bucket = 'gs://EDITEDHERE.appspot.com'
exports.scheduledFirestoreExport = (event, context) => {
const databaseName = client.databasePath(
process.env.GCLOUD_PROJECT,
'(default)'
);
return client
.exportDocuments({
name: databaseName,
outputUriPrefix: bucket,
// Leave collectionIds empty to export all collections
// or define a list of collection IDs:
// collectionIds: ['users', 'posts']
collectionIds: [],
})
.then(responses => {
const response = responses[0];
console.log(`Operation Name: ${response['name']}`);
return response;
})
.catch(err => {
console.error(err);
});
};
和包. json
{
"dependencies": {
"@google-cloud/firestore": "^1.3.0"
}
}
1条答案
按热度按时间nr9pn0ug1#
我找到了这些很棒的视频教程How to schedule firestorm backups和How To Transfer Firestore Data From One Project To Another