[英]Firebase onCall function headers and parameters
Can someone tell me how I should start with a Firebase onCall
function?有人能告诉我应该如何从 Firebase onCall
function 开始吗? according to the documentation there is a protocol of headers and parameters that I have to include, where should I include them?.根据 文档,我必须包含一个标头和参数协议,我应该在哪里包含它们? I am working from my localhost with Emulators.我正在使用模拟器在本地主机上工作。
I try something as simple as this:我尝试这样简单的事情:
export const getFileInformation2 = functions.https.onCall( (data, context) => {
return { msg: 'Hello from Firebase!' };
});
Then I run:然后我运行:
firebase emulators:start --only functions
So it generates the following url:因此它生成以下 url:
http://localhost:5001/[myProjectName]/us-central1/getFileInformation2
but it throws error:但它会引发错误:
{"error":{"message":"Bad Request","status":"INVALID_ARGUMENT"}}
onCall
is meant for when you are using the client SDKs for firebase Docs . onCall
适用于使用 firebase Docs的客户端 SDK 时。 If you are calling a url using curl or any non-sdk client use the onRequest
Docs如果您使用 curl 或任何非 sdk 客户端调用 url,请使用onRequest
Docs
If you want to use on call, a good example on using the client sdk can be found here如果您想使用 on call,可以在此处找到使用客户端 sdk 的一个很好的示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.