Closed vctfernandes closed 7 years ago
Is the err arg set?
Without running it my best guess is:
async.waterfall([
function(callback) {
mailchimp.batch({
method: 'get',
path : 'lists/id/members',
query : {
count: 100000000,
fields: 'members.member_rating,members.email_address,members.stats.avg_open_rate,members.stats.avg_click_rate'
}
}, function(err, res) {
1) something went wrong, err is set here
callback(err, res)
}, { verbose: false })
}
], function(err, res) {
2) because no successfull callbacks above, only error is set.
async.each(res.members, function(member, callback) { // res is undefined here
...
})
})
If this is not the case, and you never get to 1) I'll look into it.
Well,
I have it now checking for error. No error and it's working now... I probably had something wrong in the code. I'll let you know if it happens again without it being my fault.
Thanks for being so helpful and friendly 👍
Hey guys,
So, I started using this module with this structure:
Unfortunately, there's been an error appearing at the async.each line: Unhandled rejection TypeError: Cannot read property 'members' of undefined
Apparently, it's starting before res is sent, therefore, before the mailchimp callback. This does not happen when I do not use async.each inside the final callback. Any ideas?