我在环境A调用环境B的云函数,然后在云函数中调用订阅消息api,返回40003
日志如下
2021-01-15T09:34:20.268Z event { data:
{ date2: { value: '2021-01-16' },
thing4: { value: '没有时间' },
thing6: { value: '科目二' },
thing8: { value: '13:00 - 13:10' },
thing9: { value: '您的预约已取消,如有疑问请联系教练' } },
openId: 'oI28U5b_bpcQrr1uRsBRjM8X1zbM',
page: '/pages/driveexam/main/index?merchantid=99999999',
templateId: '-G3KZWZ7c_k2AUxZhsDZRFlgMzKW6-Emk2qEy3UdP6I',
userInfo:
{ appId: 'wxe23e94a242d4d802',
openId: 'oI28U5b_bpcQrr1uRsBRjM8X1zbM' } } //这里的openId是我在环境A调用的时候补上的
2021-01-15T09:34:20.270Z wxContext { APPID: 'wxe23e94a242d4d802',
ENV: 'jishi-appoint-test-0d6os0bb0979c',
SOURCE: 'wx_client,scf' }
2021-01-15T09:34:20.270Z 发送内容(api参数) { touser: 'oI28U5b_bpcQrr1uRsBRjM8X1zbM',
page: '/pages/driveexam/main/index?merchantid=99999999',
data:
{ date2: { value: '2021-01-16' },
thing4: { value: '没有时间' },
thing6: { value: '科目二' },
thing8: { value: '13:00 - 13:10' },
thing9: { value: '您的预约已取消,如有疑问请联系教练' } },
templateId: '-G3KZWZ7c_k2AUxZhsDZRFlgMzKW6-Emk2qEy3UdP6I' }
2021-01-15T09:34:20.530Z { Error: errCode: 40003 | errMsg: openapi.subscribeMessage.send:fail invalid openid rid: 6001619c-29b03240-4563c358
at callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2378:31)
at process._tickCallback (internal/process/next_tick.js:68:7)
errCode: 40003,
errMsg:
'openapi.subscribeMessage.send:fail invalid openid rid: 6001619c-29b03240-4563c358' }
接着我直接在小程序调用环境B的云函数,调用成功,没有报40003,openid也是一样的
日志如下
2021-01-15T09:35:00.714Z event { data:
{ date2: { value: '2021-01-16' },
thing4: { value: '没有时间' },
thing6: { value: '科目二' },
thing8: { value: '13:00 - 13:10' },
thing9: { value: '您的预约已取消,如有疑问请联系教练' } },
page: '/pages/driveexam/main/index?merchantid=99999999',
templateId: '-G3KZWZ7c_k2AUxZhsDZRFlgMzKW6-Emk2qEy3UdP6I',
userInfo:
{ appId: 'wxe23e94a242d4d802',
openId: 'oI28U5b_bpcQrr1uRsBRjM8X1zbM' } }
2021-01-15T09:35:00.714Z wxContext { UNIONID: '',
CLIENTIP: '10.12.23.71',
CLIENTIPV6: '::ffff:10.12.23.71',
FROM_APPID: '',
FROM_OPENID: '',
FROM_UNIONID: '',
OPEN_DATA_INFO: '',
APPID: 'wxe23e94a242d4d802',
OPENID: 'oI28U5b_bpcQrr1uRsBRjM8X1zbM',
ENV: 'jishi-appoint-test-0d6os0bb0979c',
SOURCE: 'wx_devtools' }
2021-01-15T09:35:00.714Z 发送内容 { touser: 'oI28U5b_bpcQrr1uRsBRjM8X1zbM',
page: '/pages/driveexam/main/index?merchantid=99999999',
data:
{ date2: { value: '2021-01-16' },
thing4: { value: '没有时间' },
thing6: { value: '科目二' },
thing8: { value: '13:00 - 13:10' },
thing9: { value: '您的预约已取消,如有疑问请联系教练' } },
templateId: '-G3KZWZ7c_k2AUxZhsDZRFlgMzKW6-Emk2qEy3UdP6I' }
END RequestId:f045871a-5714-11eb-8a0e-5254002665ac
Report RequestId:f045871a-5714-11eb-8a0e-5254002665ac Duration:314ms Memory:256MB MemUsage:26.394531MB
腾讯云TCB提供存储及计算服务
openid是一样的,这种情况要怎么解决?
你好,可以使用环境共享能力。
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/resource-sharing/