9***@qq.com
9***@qq.com
  • 发布:2022-08-23 23:55
  • 更新:2022-08-24 14:06
  • 阅读:380

payment-notify云函数偶发报错

分类:uni-app

支付偶尔有几单,收到支付通知云函数,偶尔会出现错误

云函数内容

 let verifyResult = await uniPayInstance.verifyPaymentNotify(event)  
  if (!verifyResult) {  
    console.log('---------!verifyResult-------')  
    return {}  
  }  
  let {  
    outTradeNo,  
    totalFee,  
    transactionId,  
    resultCode  
  } = verifyResult  

console.log('收到支付结果')  
console.log("verifyResult: " + verifyResult);

而回传结果会提示错误
2022-08-23T13:50:37.707Z START
2022-08-23T13:50:37.717Z "收到支付结果"
2022-08-23T13:50:38.371Z REPORT RequestId:83581c40-22a7-11ed-804e-52540095043a Duration:6ms Memory:256MB MemUsage:37.678116MB
2022-08-23T13:50:38.371Z END
2022-08-23T13:50:38.371Z ERROR RequestId:83581c40-22a7-11ed-804e-52540095043a Result:{"errCode":1,"errMsg":"user code exception caught","stackTrace":"Cannot convert object to primitive value
TypeError: Cannot convert object to primitive value
at Object.exports.main (/var/user/__index.js:90:30)
at \u003canonymous\u003e
at process._tickCallback (internal/process/next_tick.js:188:7)"}

这是什么原因,下面是成功的信息
2022-08-23T13:05:39.587Z START
2022-08-23T13:05:39.592Z "收到支付结果"
2022-08-23T13:05:39.592Z "verifyResult: [object Object]"

2022-08-23T13:05:40.150Z REPORT RequestId:3b23e0ea-22a1-11ed-a54c-525400ead648 Duration:72ms Memory:256MB MemUsage:34.807022MB
2022-08-23T13:05:40.150Z END

2022-08-23 23:55 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

看下你的云函数index.js第90行怎么写的

  • 9***@qq.com (作者)

    console.log("verifyResult: " + verifyResult)

    2022-08-24 14:54

  • DCloud_uniCloud_WYQ

    回复 9***@qq.com: 改成 console.log("verifyResult: " , verifyResult) 看看输出什么

    2022-08-24 18:25

该问题目前已经被锁定, 无法添加新回复