开发者工具v1.03 2005140, node8.9,基础库2.2.5, 云函数代码中 import waterfall from 'aysnc/waterfall' 后本地调试只能加载左面的云函数列表,中间调试窗口和右边子窗口都空白无发硬。
注释掉import语句后调试器正常,但是报一个奇怪的语法错误, 说希望执行一个函数,实际上waterfall已经执行了。 上传图片总是失败,
[error] Uncaught Exception: Error: expected a function
at wrapAsync (E:\wx\projs\wxminiProgCloud\cloudfunctions\ftpOper\node_modules\async\dist\async.js:198:50)
at nextTask (E:\wx\projs\wxminiProgCloud\cloudfunctions\ftpOper\node_modules\async\dist\async.js:4575:24)
at Object.waterfall (E:\wx\projs\wxminiProgCloud\cloudfunctions\ftpOper\node_modules\async\dist\async.js:4587:9)
at Object.awaitable [as waterfall] (E:\wx\projs\wxminiProgCloud\cloudfunctions\ftpOper\node_modules\async\dist\async.js:208:32)
at E:\wx\projs\wxminiProgCloud\cloudfunctions\ftpOper\index.js:141:17
at E:\wx\projs\wxminiProgCloud\cloudfunctions\ftpOper\node_modules\async\dist\async.js:2154:44
at replenish (E:\wx\projs\wxminiProgCloud\cloudfunctions\ftpOper\node_modules\async\dist\async.js:440:21)
at E:\wx\projs\wxminiProgCloud\cloudfunctions\ftpOper\node_modules\async\dist\async.js:445:13
at eachLimit$1 (E:\wx\projs\wxminiProgCloud\cloudfunctions\ftpOper\node_modules\async\dist\async.js:2243:34)
at awaitable (E:\wx\projs\wxminiProgCloud\cloudfunctions\ftpOper\node_modules\async\dist\async.js:208:32)
以下是waterfall函数的输出
query:
/E:/wx/projs/wxminiProgCloud/cloudfunctions/ftpOper/index.js:85 db get err: TypeError: Cannot read property 'getTime' of undefined
/E:/wx/projs/wxminiProgCloud/cloudfunctions/ftpOper/index.js:28 save file cmp: [object Object]
/E:/wx/projs/wxminiProgCloud/cloudfunctions/ftpOper/index.js:18 mycallback
index.js:170 ftp connection had end
index.js:165 ftp connection had closed with err: false
代码如下,
let i = 0
ipCamMapArr = new Array()
ipCamMap.forEach(function(key){
ipCamMapArr[i] = {ip: key, filetime: ipCamMap.get(key)}
i++
})
function cb(){console.log('cb,cb')}
async.eachSeries(ipCamMapArr,
function(item, cb){
async.waterfall(
[
ftpGetPicFile(item, mycallback),
savePicFile(item, mycallback),
//checkPicFile(item, cb2),
updateRec(item, mycallback)
],
function(err, result){
console.log('waterfall cb: ' + err + ', res: ' + result)
}
)
cb()
},
function(err, result){
console.log('eachofser cb: ' + err + ', res: ' + result)
}
)