简体   繁体   English

Firebase onCall function 头文件和参数

[英]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.

相关问题 Firebase Function onCall 中“数据”的数据类型 function - Firebase Function Data Type of "data" in onCall function CORS onCall firebase V9 中的策略错误 firebase function - CORS Policy error in firebase V9 on an onCall firebase function Firebase 函数 onRequest 到 onCall - Firebase functions onRequest to onCall Firebase 实时数据库 onCall function 不从 remove() 操作返回响应数据 object - Firebase realtime database onCall function does not return a response data object from remove() operation 如何从 onCall firebase function 中提取值并将它们加载到未来的构建器中 - How to extract values from onCall firebase function and load them in future builder 为什么 Firebase onCall 的授权验证效率低下? - Why authorization validation for Firebase onCall is inefficient? 传参给 Firebase 云端 function - Pass parameters to Firebase cloud function Firebase onCall 方法在代码执行完成之前完成 - Firebase onCall method finishes before code execution completes Firebase 云 Function 错误:“将标头发送到客户端后无法设置标头” - Firebase Cloud Function Error: "Cannot set headers after they are sent to the client" Firebase (with react native) HTTPS function 没有收到参数 - Firebase (with react native) HTTPS function doesn't receive parameters
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM