javascript - Meteor Fiber Email -
i'm attempting send simple email (locally, environment variables aren't set), , get: error: meteor code must run within fiber. try wrapping callbacks pass non-meteor libraries meteor.bindenvironment.
here's code
meteor.methods({ sendinviteemail: function(emails) { console.log("[sendinviteemails], ", emails); if (emails !== void 0) { console.log("[sendinviteemails] calling meteor method: sendemail"); return meteor.call("sendemail", emails, "email@gmail.com", "test", "test"); } }, sendemail: function(to, from, subject, text) { this.unblock(); email.send({ to: to, from: from, subject: subject, text: text, }); }, });
i'm on calling sendinviteemail (will checking validaty on server) client , passing data sendemail (which why have bit of redudancy currently). code docs.meteor.com, i'm wondering why present fiber issue.
thanks much
your code works fine me. copied code straight , called
meteor.call("sendinviteemail", "my.email@mydomain.com")
from client console , went fine.
i think might have installed email
incorrectly. error if run async functions npm package. install email
package need run
meteor add email
i guessing added npm package or something. hope helps.
if interested in error had lot of problems same error when built app listened on postresql trigger. used pg package atmosphere (https://atmospherejs.com/package/postgresql) working needed wrap functions in meteor's environment using meteor._wrapasync
. here example:
// wrap connect function pg.wrapped_connect = meteor._wrapasync(pg.connect.bind(pg)); // run connect usual pg.wrapped_connect(conparams, function(err, client) { ... });
Comments
Post a Comment