怎么我用旧版本没问题,下载了新版本出现这样?
发布于 6 年前 作者 jshi 4430 次浏览 来自 官方Issues
// 云函数入口文件
const cloud = require('wx-server-sdk')
var util = require('util.js');
cloud.init()
const db = cloud.database()
var shijian = util.formatTime(new Date());

// 云函数入口函数
//查询"附近拼单"
exports.main = async (event, context) => {
  var options = {
    uri: 'https://apis.map.qq.com/ws/direction/v1/driving/?from=39.915285,116.403857&to=39.915285,116.803857&waypoints=39.111,116.112;39.112,116.113&output=json&callback=cb&key=O3IBZ-WC7WJ-JTHFZ-FKFME-XUOSH-SFBSI',
    method: 'GET',
    json: true
  }
  console.log(options.result)
  console.log("333")
}
返回结果
{"errorCode":-1,"errorMessage":"Runtime.HandlerNotFound: index:main is undefined or not exported\n    at Object.module.exports.load (/var/runtime/node10/UserFunction.js:47:11)\n    at Runtime.handleOnce (/var/runtime/node10/Runtime.engine.js:95:38)\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)"}

回到顶部