为什么在云 函数中使用事务会抛出 CloudSDKError ?
基础信息
基础调试库:2.10.3
APPID:wx18aba0e77e3a9f1d
云开发环境ID:develop-4lzw3
云函数代码
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
exports.main = async (event, context) => {
let transaction = await db.startTransaction()
let result = await transaction.collection('todos').add({ data: { name: "test" } })
await transaction.commit()
console.log(result)
}
报错信息
函数执行失败(耗时 395ms) CloudSDKError: errCode: -1 unknown error | errMsg: collection.add:fail Error: 400 Bad Request; at collection.add api;