const cloud = require('@alipay/faas-server-sdk');
// cloud 实例默认即请求当前云函数所在云环境,因此通常情况下无需此设置
cloud.init({
env: cloud.dynamic_current_env,
});
const cloud = require('@alipay/faas-server-sdk');
const custom = new cloud.cloud();
// custom 默认请求 test-a1b2c3 环境资源
custom.init({
env: 'test-a1b2c3',
});
// 对于 echo 云函数的调用,将会请求当前云环境,而非 test-a1b2c3 环境
const res = await custom.callfunction({
name: 'echo',
data: {},
config: {
env: cloud.dynamic_current_env,
},
});