Google cloud firestore 对Firestore的调用在本地通过Shell工作,但在部署到云函数后给出空错误
我正在使用Firebase函数对Firestore进行查询。当我从本地shell运行函数时,一切正常 但是,在部署代码并调用函数后,Firestore在生产中返回一个空白错误{} Firestore权限不应该是这里的问题,因为它在本地工作 服务帐户也不应成为问题 没有错误消息或调试信息。我还检查了服务器控制台上的功能日志Google cloud firestore 对Firestore的调用在本地通过Shell工作,但在部署到云函数后给出空错误,google-cloud-firestore,google-cloud-functions,google-admin-sdk,firebase-cli,firebase-tools,Google Cloud Firestore,Google Cloud Functions,Google Admin Sdk,Firebase Cli,Firebase Tools,我正在使用Firebase函数对Firestore进行查询。当我从本地shell运行函数时,一切正常 但是,在部署代码并调用函数后,Firestore在生产中返回一个空白错误{} Firestore权限不应该是这里的问题,因为它在本地工作 服务帐户也不应成为问题 没有错误消息或调试信息。我还检查了服务器控制台上的功能日志 firestore.collection("users").doc(uid).set(userJson, {merge:true}) .then((
firestore.collection("users").doc(uid).set(userJson, {merge:true})
.then((done) => {
console.log('Created new user');
}).catch(err => {
console.log('Error creating new user:', JSON.stringify(err));
});
Package.json
"engines": { "node": "8" }
我希望部署后的行为与shell中的行为相同。如何从Firebase Functions server获取对Firestore work的调用
“引擎”:{“节点”:“10”}
npm安装-g firebase工具
npm cache clean--force
,然后重试
response.send()
。正确使用async/await
或.then()
npm list -g --depth=0
npm uninstall -g firebase-tools
npm install -g firebase-tools
npm list -g --depth=0
firestore.collection("users").doc("123").set({
id: 1234,
'': 'something', // ERROR
phone: undefined, // ERROR
email: 'user@email.com'
})