【发布时间】:2020-08-18 21:31:00
【问题描述】:
当我使用浏览器监听本地端口时,以下方法返回 Hello world。
//节点
app.get('/', (req,res)=>{
res.send('Hello world')
});
我已将应用导出为可调用的云函数,成功命名为:getConstits
//节点
exports.getConstits = functions.https.onCall(app);
然后我在客户端中调用该函数。
//客户端
final HttpsCallable callable = CloudFunctions.instance.getHttpsCallable(
functionName: 'getConstits',
);
getElec()async{
dynamic resp = await callable.call();
print(resp);
}
但我得到一个未处理的异常(如果需要,将发布)。云函数生成的url返回{"error":{"message":"Bad Request","status":"INVALID_ARGUMENT"}}。我想向客户端返回 hello world?
【问题讨论】:
标签: javascript firebase express google-cloud-functions