- 采用绑定gitee代码仓库方式部署python flask服务总是失败?
环境id:prod-2gdt5yntac670964;服务名称:ai-server;版本:ai-server-002;状态:部署失败 Dockerfile内容如下: FROM tiangolo/uwsgi-nginx-flask:python3.8 FROM python:3.8-slim COPY ./app /app/ COPY ./requirements.txt ./
2022-03-19 - subscribeMessage.send errCode: -504002报错?
[图片]Error: cloud.callFunction:fail Error: errCode: -504002 functions execute fail | errMsg: TypeError: Do not know how to serialize a BigInt 调用订阅消息后测试消息可以发送成功,但是返回值报错Do not know how to serialize a BigInt,无法判断是否发送成功。 2022-05-01 解决方法:云函数的返回值不要返回result,直接返回result.errCode,就不会报错。原因是直接返回result被序列化导致报错(其实就是bug),所以返回result.errCode足以用于判断!
2022-05-01 - 如何解决在云函数中调用subscribeMessage.send出错问题?
在用云函数定时触发器开发消息订阅功能时,遇到一个问题。 环境:基础版本库2.17.0 在定时器函数中,调用另外一个云函数,该云函数中调用了cloud.openapi.subscribeMessage.send。在云函数日志端显示函数调用失败,但是在微信里可以收到一条订阅消息。二其它的订阅消息就无法收到。日志显示异常信息如下: exception occured { "errCode": -504002, "errMsg": "callFunction:fail -504002 functions execute fail. requestID t_1647352800638_12041-17f8de0ebd5_2, TypeError: Do not know how to serialize a BigInt\n at JSON.stringify (<anonymous>)\n at callback (/var/runtime/node12/CallbackContext.js:31:23)\n at /var/runtime/node12/CallbackContext.js:81:16\n at /var/runtime/node12/Runtime.engine.js:237:13\n at processTicksAndRejections (internal/process/task_queues.js:97:5)" 出现问题的云函数代码如下: const cloud = require('wx-server-sdk') cloud.init({ env:cloud.DYNAMIC_CURRENT_ENV }); const GOOD_GIFTS = [ { "type":"每周好物推荐", "title":"适合送给亲人和朋友的德尔玛加湿器", "notify":"每周五晚19:00准时更新", "date":"2022-03-25", // "abstract":"德尔玛加湿器" "abstract":"比京东同款便宜约20%~30%" } ]; /* the procedure: 1.get all the subscriber's openid 2.send the notify message to every subscriber */ exports.main = async (event, context) => { // get openid const allOpenid = await cloud.callFunction({ name:"getAllOpenid", }); if( allOpenid == null ) return; // get all the subscribers's openid array candidateSets = allOpenid.result.data; console.log("candidateSets = ",candidateSets); for( let i = 0; i < candidateSets.length; i++){ console.log("sending the subscribe messege to the user:",candidateSets[i]._openid); for(let j = 0; j < GOOD_GIFTS.length; j++){ try{ // send the subsribe message res = await cloud.callFunction({ // the cloud function name name:"subscribeGift", // the parameter:open id, then cloud function will use event.openid to get the parameter data:{ openid : candidateSets[i]._openid, type : GOOD_GIFTS[j].type, title : GOOD_GIFTS[j].title, notify : GOOD_GIFTS[j].notify, date : GOOD_GIFTS[j].date, abstract : GOOD_GIFTS[j].abstract } }); }catch(err){ console.log("exception occured",err); }finally{ console.log("sended the subscribe messege to the user:",candidateSets[i]._openid); console.log("subscribeGift call result is:",res); } } //end of inner for loop }//end of outer for loop if( res ) return true; else return false; } }
2022-03-15