本地测试可以在云函数获取用户数据的代码,怎么部署后就获取不了变成undefined?
在本地测试运作完美无缺的代码,部署到production就给个undefined?!
local debug: 前端:userInfo: wx.cloud.CloudID(e.detail.cloudID) 后端:event.userInfo.data 是 带有nickname等数值的JSON 部署后: 前端:userInfo: wx.cloud.CloudID(e.detail.cloudID) 后端:event.userInfo.data 是 undefined
详细代码-
云函数(get-user-info-and-save):
exports.main = async (event, context) => {
console.log(event)
const {nickName, openId, gender, city, province, language, country, avatarUrl,unionId} = event.userInfo.data
....
}
前端:
onGetUserInfo (e) {
console.log(e.detail)
if(!_.isUndefined(e.detail.rawData)){
this.setState({
isWaiting: true
})
wx.cloud.callFunction({
data: {
userInfo: wx.cloud.CloudID(e.detail.cloudID)
},
name: 'get-user-info-and-save',
success: this.setUserProfileInfo.bind(this),
fail: (e)=>{
this.setState({
networkHazProblem0: true,
isWaiting: false,
})
}
})
}
}