const cloud = require('wx-server-sdk')
cloud.init(
{
env:cloud.DYNAMIC_CURRENT_ENV
}
)
exports.main = async (event, context) => {
let access_token=event.access_token
let job_id = event.job_id
console.log(access_token)
console.log(job_id)
let options = {
url: "https://api.weixin.qq.com/tcb/databasemigratequeryinfo?access_token=" + access_token,
body: ({
"env": "xcxdemo-20c411",
"job_id":job_id
})
}
let res = await request(options)
return res
}
使用https:
将json数据导入到云开发数据后,数据已经导入到数据库中,并且返回了job_id,我想监控任务的情况,云函数内容如上图,请问错在什么地方了,报错信息如下
捕捉到的错误信息 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID ffa56083-32ed-11eb-9e5c-5254008c2339, cloud function service error code -504002, error message ReferenceError: request is not defined
at Runtime.exports.main [as handler] (:54908/var/user/index.js:23)
at Runtime.handleOnce (:54908/var/runtime/node10/Runtime.engine.js:214)
at Timeout.setTimeout [as _onTimeout] (:54908/var/runtime/node10/Runtime.engine.js:54)
at ontimeout (:54908/appservice/timers.js:436)
at tryOnTimeout (:54908/appservice/timers.js:300)
at listOnTimeout (:54908/appservice/timers.js:263)
at Timer.processTimers (:54908/appservice/timers.js:223); at cloud.callFunction api;
at new u (VM1195 WAService.js:2)
at d (VM1195 WAService.js:2)
at f (VM1195 WAService.js:2)
at Function.success (VM1195 WAService.js:2)
at h (VM1195 WAService.js:2)
at VM1195 WAService.js:2
at k (VM1195 WAService.js:2)
at Function.<anonymous> (VM1195 WAService.js:2)
at h (VM1195 WAService.js:2)
at VM1195 WAService.js:2
const request = require('request ') 学会看报错