错误信息
返回结果
{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"ReferenceError: enent is not defined\n at Runtime.exports.main [as handler] (/var/user/index.js:16:21)\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}
ERROR RequestId:024fa213-5ac4-11eb-8d8d-52540036d55c Result:{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"ReferenceError: enent is not defined\n at Runtime.exports.main [as handler] (/var/user/index.js:16:21)\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}
END RequestId:024fa213-5ac4-11eb-8d8d-52540036d55c
Report RequestId:024fa213-5ac4-11eb-8d8d-52540036d55c Duration:6ms Memory:256MB MemUsage:26.394531MB
回调函数
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
const db = cloud.database()
console.log('支付回调:', event)
const orderId = event.outTradeNo
const subMchId = event.subMchId
const returnCode = event.returnCode
const orderType = enent.attach
if (returnCode == 'SUCCESS') {
if (orderType == 'Vip') {
const result = await db.collection('VipOrder')
.where({
_id: orderId
})
.update({
data: {
outTradeNo: orderId,
}
})
const res = {
errcode: 0,
errmsg: '',
result: result,
}
return res
} else {
const result = await db.collection('SaleOrder')
.where({
_id: orderId
})
.update({
data: {
status: 1,
subMchId: subMchId,
outTradeNo: orderId,
}
})
const res = {
errcode: 0,
errmsg: '',
result: result,
}
return res
}
}
}
enent is not defined
这样的错误信息都不会排查的话,你要考虑是否继续吃开发这碗饭了。