跳到主要内容

云函数

callFunction

callFunction(object: Object): Promise<Object>

1. 接口描述

接口功能:执行云函数

2. 输入参数

object
Object

函数型云托管 额外可以传参数,传入 `type:'cloudrun'` 参数后,将调用函数型云托管 服务
object
Object

3. 输出参数

Promise
Object

4. 示例代码

import cloudbase from "@cloudbase/js-sdk";
//初始化SDK实例
const app = cloudbase.init({
env: "xxxx-yyy",
});

app
.callFunction({
name: "test",
data: { a: 1 },
})
.then((res) => {
const result = res.result; //云函数执行结果
});