[英]Firebase Functions response returns null
tried get list of objects from s3(actually from wasabi) but in react always returns null 尝试从s3获取对象列表(实际上是从wasabi),但是在react中总是返回null
function code: (using node 8) 功能代码:(使用节点8)
exports.fetchWasabi = functions.https.onCall(() => {
const params =
{
Bucket: 'balde1-webcars',
};
s3.listObjectsV2(params, function(err, result) {
if (!err) {
console.log(result)
return result
} else {
console.log(err);
return err
}
});
});
react code: 反应代码:
componentDidMount(){
var Wasabi = firebase.functions().httpsCallable('fetchWasabi');
Wasabi().then(function(result) {
var res = result.data;
console.log(res)
}).catch(function(error) {
console.log(error)
});
}
when i check the log for the function i can see the result but it never reaches my browser apparently 当我检查日志中的功能时,我可以看到结果,但是它似乎从未到达我的浏览器
您没有返回任何东西,因此您应该再添加一个返回值,例如:
return s3.listObjectsV2(params, function(err, result) { ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.