【发布时间】:2018-05-06 17:23:44
【问题描述】:
当我从登录的 Android 客户端向 Firestore 写入数据时, 我无法获取 onWrite 触发器的身份验证信息。
当我打印应该使用 UID 存储身份验证对象的上下文对象时,我看到身份验证对象不存在。
我应该获得有关 Firestore 上任何写入的信息。
这是我使用的示例代码。
exports.testTrigger = functions.firestore
.document('col1/doc1/col2/{doc2}')
.onWrite((change, context) => {
console.log('context = ', context);
const auth = context.auth;
console.log('auth = ', auth);
});
云函数日志中的输出:
context = { eventId: '3c2295a4-2823-4fba-b406-728d7d77f6de-0',
timestamp: '2018-05-06T17:11:12.771855Z',
eventType: 'google.firestore.document.write',
resource:
{ service: 'firestore.googleapis.com',
name: 'projects/xyz/databases/(default)/documents/col1/doc1/col2/gFRWgJg37DmB5wchWLBV' },
params: { request_id: 'gFRWgJg37DmB5wchWLBV' } }
auth = undefined
【问题讨论】:
标签: firebase google-cloud-firestore google-cloud-functions