微信公众号和小程序 是不是搞混了,各自有各自的白名单
公众号配置了白名单ip,小程序调用还是提示not in whitelist rid?[图片] https://api.weixin.qq.com/cgi-bin/media/get?mediaId=ywOjQqGSylFNgqWg1hKtXoCx2RQgXFgjAzlyssFqdDkvtYsiCTHyKJxHbPIxk_gN {"errcode":40164,"errmsg":"invalid ip 218.205.135.130 ipv6 ::ffff:218.205.135.130, not in whitelist rid: 66f22d7a-4250d877-25376f64"} [图片] 这个白名单ip2021年小程序上线之初就维护好了没动过,现在突然出现这个报错,看看啥情况
09-24 const WXContext=cloud.getWXContext(); let res = await cloud.openapi({appid:'wx0990bd0b76016244'}).cloudbase.getOpenData({ openid:WXContext.FROM_OPENID, cloudidList: [cloudID], }); if (res && res.dataList[0] && res.dataList[0].json) { const jsonData = JSON.parse(res.dataList[0].json); return jsonData.data.phoneNumber; } else return ''; 看了手册好像可以指定小程序身份调用openapi,但是这样写了B小程序调用也没有返回,错误信息是 {"router":"passport/phone","level":"error","src":"app","requestId":"36dbf5dd-e312-457f-bea0-1bd6a3e74490","function":"cloud","errMsg":"errCode: 40003 | errMsg: openapi.cloudbase.getOpenData:fail invalid openid rid: 634e5106-7615b60b-140a9977","errStack":"Error: errCode: 40003 | errMsg: openapi.cloudbase.getOpenData:fail invalid openid rid: 634e5106-7615b60b-140a9977\n at callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2227:31)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)\n at async PassportService.getPhone (/var/user/service/passport_service.js:231:13)\n at async PassportController.getPhone (/var/user/controller/passport_controller.js:45:10)\n at async Object.app (/var/user/framework/handler/application.js:69:16)\n at async Runtime.exports.main [as handler] (/var/user/index.js:5:9)","timestamp":"1666076934442257"}
跨账号共享环境下getOpenData无法获取对应数据https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/open/Cloud.getOpenData.html 假设小程序A的云环境CA为要共享的云环境,小程序B是无云环境的被共享小程序,在跨账号共享环境时,B调用CA的云函数,为了快速获取用户手机号及头像昵称等,云函数使用了getOpenData,但是A调用是返回正常,B调用时返回了一个错误,错误如下,请问该如何解决。 { "cloudID": "61_huCyHuY48m72wWN0PmHTYGw4dmUTYFxAFLm3-Q-UYWZj4LbqBFqTWNXAk7E" } { "list": [ { "cloudID": "61_huCyHuY48m72wWN0PmHTYGw4dmUTYFxAFLm3-Q-UYWZj4LbqBFqTWNXAk7E", "errCode": -601007, "errMsg": "cloudID not belong to user." } ], "errMsg": "getOpenData:ok", "errCode": 0 }
2022-10-18