Hi there,
I need to call an async method in a meteor method. I’m trying to use Meteor.wrapAsync
for this, but it is only returning {state: 'pending'}
. How can I resolve this?
The normal async request:
chargebee.portal_session.create({
embed: true,
redirect_url : "https://example.com",
customer : {
id : Meteor.userId()
}
}).request((error, result) => {
console.log(result);
});
The request with wrapAsync returning state pending:
try {
var query = chargebee.portal_session.create({
embed: true,
redirect_url : "https://example.com",
customer : {
id : Meteor.userId()
}
});
var result = Meteor.wrapAsync(query.request)();
console.log("result", result);
return result;
} catch (error) {
throw new Meteor.Error(500, 'Failed to retrieve billing page', error);
}