調(diào)用失敗 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 6885a8c3-7483-11ea-9a3c-525400c7e4d7, cloud function service error code -504002, error message errCode: -502005 database collection not exists | errMsg: [ResourceNotFound] Db or Table not exist. Please check your request, but if the problem cannot be solved, contact us.;
Error: errCode: -502005 database collection not exists | errMsg: [ResourceNotFound] Db or Table not exist. Please check your request, but if the problem cannot be solved, contact us.;
這個(gè)錯(cuò)讓我頭大了好久,云數(shù)據(jù)庫(kù)中明明有那個(gè)表,刪了再加也不對(duì),難道遇到鬼了?!
偶然中靈光一閃,意識(shí)到會(huì)不會(huì)和云控制臺(tái)的多個(gè)環(huán)境有關(guān)?于是在網(wǎng)上尋找答案,終于完美解決。解決方法如下:
如果云控制臺(tái)有多個(gè)環(huán)境,在云函數(shù)中初始化的時(shí)候必須指定環(huán)境id,否則,默認(rèn)用第一個(gè)環(huán)境,不管你在開(kāi)發(fā)時(shí)指定的環(huán)境是哪個(gè)!也不管你的app.js中初始化的環(huán)境是哪個(gè)!
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
})
唉,感覺(jué)微信的坑好多。。。
我在開(kāi)發(fā)中遇到的更多的坑都已經(jīng)記錄在easyDemo小程序中,希望我的demo能給你easy。我還會(huì)持續(xù)更新easyDemo,歡迎收藏。
