错误
Uncaught (in promise) thirdScriptError
errCode: -401003 api parameter type error | errMsg: parameter.data should be object instead of undefined;
Error: errCode: -401003 api parameter type error | errMsg: parameter.data should be object instead of undefined;
at new u (...)
...
错误原因
错误写法
wx.cloud.init({
env: '我的云ID',
traceUser: true
})
const db = wx.cloud.database()
const people = db.collection('people')
people.add({ // <- 报错
'name': 'OnePerson',
'score': 15
})
正确写法
wx.cloud.init({
env: '我的云ID',
traceUser: true
})
const db = wx.cloud.database()
const people = db.collection('people')
people.add({
data: { // 必须加上data!
'name': 'OnePerson',
'score': 15
}
})
标签:...,401003,people,data,errCode,api,parameter,errMsg
From: https://www.cnblogs.com/stanleys/p/18403362