我正在尝试使用此处的说明设置我的 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 运行正常。 我也试过寻找脚本中的错误。 索引.js
const firestore = require('@google-cloud/firestore');
const client = new firestore.v1.FirestoreAdminClient();
// Replace BUCKET_NAME
const bucket = 'gs://IWROTEMYBUCKETNAMEHERE'
exports.scheduledFirestoreBackup = (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);
});
};
和 package.json
{
"dependencies": {
"@google-cloud/firestore": "^1.3.0"
}
}