Skip to main content

Cloud function

Note

When calling cloud storage-related APIs, version v3 uses the open capability of [cloud function HTTP API](/HTTP-API/functions/cloud function). Before using, please go to [cloud Development Platform/identity Authentication/Permission control](tcb.cloud.tencent.com/dev? envId=#/identity/auth-control/detail? roleIdentity=registerUser&tab=strategy) Verify that the policy management configuration for FunctionsHttpApiAllow is as expected. For more information, see Policy Management Documentation.

callFunction

callFunction(object: Object): Promise<Object>

1. API Description

API feature: Execute SCF

2. Input Parameters

object
Object

Functional cloud hosting can also pass parameters. After inputting the `type:'cloudrun'` parameter, it will invoke the functional cloud hosting service.
object
Object

3. Output Parameters

Promise
Object

4. Example code

import cloudbase from "@cloudbase/js-sdk";
// Initialize SDK instance
const app = cloudbase.init({
env: "xxxx-yyy",
});

app
.callFunction({
name: "test",
data: { a: 1 },
})
.then((res) => {
const result = res.result; //SCF execution result
});