I’m trying to run the following code but get the infamous ‘Meteor code must always run within a Fiber…’
Here’s the code:
do {
var addSubscriptions = Meteor.wrapAsync(
sns.listSubscriptionsByTopic({NextToken: nextToken}, function (err, data) {
debugger;
if (err) console.log(err, err.stack); // an error occurred
else {
// call ListSubscriptionsByTopic again? How?
subscriptions = data.Subscriptions;
// if (NextToken) {
// nextToken = NextToken;
// index = index + 1;
// } else {
// nextToken = null;
// }
if (subscriptions) {
var length = subscriptions.length;
for (var i = 0; i < length; i++) {
var sub = subscriptions[i];
smsSubscriptions.upsert({endPoint: sub.Endpoint}, {
$set: {
endPoint: sub.Endpoint,
owner: sub.Owner,
subArn: sub.SubscriptionArn,
timeStamp: new Date()
}
});
}
}
}
})
);
}
while (nextToken !== null);
Here’s my SO question on this.