收藏
回答

如何在‘云函数’中调用callContainer

框架类型 问题类型 终端类型 AppID 环境ID 基础库版本
小程序 Bug 微信安卓客户端 wx73d535cc7d12262a qifu-0guefmbma23fbeb4 2.16.0
// 云函数入口文件
const cloud = require('wx-server-sdk')

// 初始化 cloud
cloud.init({
  // API 调用都保持和云函数当前所在环境一致
  env: cloud.DYNAMIC_CURRENT_ENV
})

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
   
  let orderDetail = await cloud.callContainer({
    path:'/****-service/order/get/contract?id'+event.orderId,
    method'GET'    
  });

  return {
    event,
    openid: wxContext.OPENID,
    appid: wxContext.APPID,
    unionid: wxContext.UNIONID,
  }
}


然后云函数就报错:

{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"TypeError: cloud.callContainer is not a function\n    at Runtime.exports.main [as handler] (/var/user/index.js:14:33)\n    at Runtime.handleOnce (/var/runtime/node10/Runtime.engine.js:214:23)\n    at Timeout.setTimeout [as _onTimeout] (/var/runtime/node10/Runtime.engine.js:54:12)\n    at ontimeout (timers.js:436:11)\n    at tryOnTimeout (timers.js:300:5)\n    at listOnTimeout (timers.js:263:5)\n    at Timer.processTimers (timers.js:223:10)","statusCode":430}
回答关注问题邀请回答
收藏

1 个回答

  • Mr.Zhao
    Mr.Zhao
    04-08

    暂不支持云函数内调用云托管

    04-08
    有用 1
    回复
登录 后发表内容
问题标签