报错如下:{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"ReferenceError: rq is not defined\n at Runtime.exports.main [as handler] (/var/user/index.js:12:20)\n at Runtime.handleOnce (/var/runtime/node12/Runtime.engine.js:219:23)\n at Timeout._onTimeout (/var/runtime/node12/Runtime.engine.js:56:12)\n at listOnTimeout (internal/timers.js:549:17)\n at processTimers (internal/timers.js:492:7)","statusCode":430}
代码咋写的
const cloud = require('wx-server-sdk')
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境
const rq = require('request-promise')
const URL = 'http://musicapi.xiecheng.live/personalized'
// 云函数入口函数
exports.main = async (event, context) => {
const playlist = await rq(URL).then((res)=>{
return res;
})
console.log(playlist)
}
request-promise包也已安装