Skip to content

Instantly share code, notes, and snippets.

@ricomoss
Created December 22, 2013 08:07
Show Gist options
  • Save ricomoss/8079625 to your computer and use it in GitHub Desktop.
Save ricomoss/8079625 to your computer and use it in GitHub Desktop.
Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
Feeds = new Meteor.Collection('feeds');
if (Meteor.isServer) {
var twitter_user_id = 0;
Meteor.methods({
twit_get: function() {
Twit = new TwitMaker({
consumer_key: 'foo',
consumer_secret: 'foo',
access_token: 'foo',
access_token_secret: 'foo'
});
console.log('user id: ' + twitter_user_id);
Twit.get(
'search/tweets',
{
q: 'banana since_id:' + twitter_user_id,
count: 10
},
function(err, reply) {
for (var obj in reply['statuses']) {
twitter_user_id = reply['statuses'][obj].user.id;
Feeds.insert({feed: reply['statuses'][obj].text});
}
});
}
});
}
if (Meteor.isClient) {
Template.twitter_feeds.feeds = function () {
return Feeds.find({}, {sort: {feed: -1}});
};
Meteor.call('twit_get');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment