Saturday 15 June 2013

mongodb - WARNING Error: Meteor code must always run within a Fiber when call method on server -


I am trying to deploy my meteor applications on the server, but this error is always on my meteor server logs Fri Jun 21 2013 11:39:31 GMT + 0000 (UTC)] Info Hit /img/bg.png 183.90.41.21 [Fri Jun 21 2013 11:39:32 GMT + 0000 (UTC)] Info Hit / Favicon.IC 183.90.41.21 [Venus 21 June 2013 11:39:41 GMT + 0000 (UTC)] Info Hit / Form 183.90.41.21 [Fri Jun 21 2013 11:39:42 GMT + 0000 (UTC)] information hit / favicon. Echo 183.90.41.21 [Fri Jun 21 2013 11:39:49 GMT + 0000 (UTC)] Warning}.) (); ^ [Venus Jun 21 2013 11:39:49 GMT + 0000 (UTC)] Warning app / server / server.js: 53 [Fri Jun 21 2013 11:39:49 GMT + 0000 (UTC)] Warning error: Meteor code Always should go within the fiber at _.extend.apply (ap / packages / survivor / livedata_server.js: 1268: 57) at _.extend.get (ap / packages / meteor / dynamics_nodges.js: 14:13) in Metaor At .startup.Meteor.methods.streamTwit (app / server / server.js: 51: 22) .extend.call (app / package / live / livedata_server.js: 1229: 17) P> But I have already wrapped it in fiber and To appreciate it are the works of local as well I really do not know if what the problem might be a help.

// server.js

  Meteor.startup (function () {var needs = Npm.require; var fs = require ('fs' var' path = Required ('path'); var base = path.rollol ('.'); Var isbundle = fs.existsSync (base + '/ bundle'); var modulepath = base + (isBundle? '/ Bundle / static': ' / 'Public') + '/ node_module'; var ntwitter = require (modulepath + '/ ntvitter'); fiber = (modulepath + '/ fiber'); var twit = new ntwitter ({consumer_key: 'my key ', User_set:' my key ', access_token_key:' my key ', access_token_secret:' my key '}); Meteor.methods ({postText: function (questionText) } {Twit.verifyCredentials (function (err, data) {If (err) {console.log ("error in confirming credentials:" + error); process.exit (1);}}.) Update status Text, work (error, data) {if (err) {console return ('teaching failure:' + fault); return return;} other {console.log ('success!'); Return true;}});} , Streamtit: function (tweet) {var userid = '1527228696'; Twit.stream ('statu ses / filter', {follow: user id}, function (stream) {stream.on ('data', function (tweet) {Fiber (function () {if (tweet.user.id_str === userid) {meteor call ('addQn ', Tweet); }}) Run (); Console.log ('---------------------- Tracking Tweet -----------------'); Console.log (tweets); Console.log ('--------------------------------------------- ------------ '); Console.log (tweet.user.screen_name); Console.log (tweet.user.name); Console.log (tweet.text); }); }); }, Edquin: Function (tweet) {question db.incent ({'tweet': tweet, 'date': new date ()}); }}); Fiber (function () {Meteor.call ('streamwit', tweet);}). Run (); });   

PS: I have changed my auto key in advance thanks

< P> I think you should call your callback instead of using fiber instead of Meteor.bindEnvironment - see here

I use it quite extensively and it is well Works because you have to go inside fiber rather than leaving and re-entering

normal callback style

  some modes ({OPTIONS}, function (Callback Returns ARGs) {// This is a normal callback);   

Build ambient callback wrapped

  some modes ({OPTIONS}, Meteor.bindEnvironment (function (callback return ARGS) {// this is normal callback} , Function (e) {console.log ('forced failure');}));   

If you continually wrap the async callback in this way, the meteor is always


accessible for this bit

 < Code> fiber (function () {Meteor.call ('streamwit', tweet);}). Run ();   

You do not need to wrap the fiber, you are already in the Meteor.startup context, so it is unnecessary - just Meteor.call (...); will move

No comments:

Post a Comment