通过GET调用Firebase云函数并返回参数 [英] Call Firebase cloud function via GET and return parameters

查看:124
本文介绍了通过GET调用Firebase云函数并返回参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了这个云功能:

exports.returnUid = functions.https.onRequest(async(req, res) => {
    const uid = req.query.uid
    res.send(uid)
});

当我调用https://<project>.cloudfunctions.net/returnUid?uid=123abc时,它将返回一个空响应,而不是应有的"uid"参数.

When I call https://<project>.cloudfunctions.net/returnUid?uid=123abc, it returns an empty response, and not the "uid" parameter as it should.

推荐答案

我发现使用firebase --serve时,该函数将不接受参数.但是当我放倒它时,它确实会发生.

I've found out that when using firebase --serve, the function won't acept parameters. But when I deplpoy it, it does.

这篇关于通过GET调用Firebase云函数并返回参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆