Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
40
rated 0 times [  43] [ 3]  / answers: 1 / hits: 5625  / 10 Years ago, sat, april 19, 2014, 12:00:00

I'm making a fairly simple meteor app for the first time that is supposed to query all of the git issues from a certain repo. After it gets a list of issues from the github api, the idea is to create a collection of tasks from these issues. However, whenever I try to query the list of current tasks I get:



.../.meteor/tools/c2a0453c51/lib/node_modules/fibers/future.js:83
W20140418-17:00:43.872(-7)? (STDERR) throw new Error('Can't wait without a fiber');
W20140418-17:00:43.872(-7)? (STDERR) ^
W20140418-17:00:43.889(-7)? (STDERR) Error: Can't wait without a fiber
W20140418-17:00:43.889(-7)? (STDERR) at Function.wait
(.../.meteor/tools/c2a0453c51/lib/node_modules/fibers/future.js:83:9)
W20140418-17:00:43.890(-7)? (STDERR) at Object.Future.wait
(.../.meteor/tools/c2a0453c51/lib/node_modules/fibers/future.js:325:10)
W20140418-17:00:43.890(-7)? (STDERR) at _.extend._nextObject (packages/mongo-
livedata/mongo_driver.js:805)
W20140418-17:00:43.890(-7)? (STDERR) at _.extend.forEach (packages/mongo-livedata/mongo_driver.js:836)
W20140418-17:00:43.890(-7)? (STDERR) at Cursor.(anonymous function) [as forEach] (packages/mongo-
livedata/mongo_driver.js:695)
W20140418-17:00:43.890(-7)? (STDERR) at app/server/publish.js:51:33
W20140418-17:00:43.890(-7)? (STDERR) at Array.forEach (native)
W20140418-17:00:43.891(-7)? (STDERR) at app/server/publish.js:49:19
W20140418-17:00:43.891(-7)? (STDERR) at
...packages/npm/.build/npm/node_modules/github/api/v3.0.0/issues.js:116:17
W20140418-17:00:43.891(-7)? (STDERR) at IncomingMessage.<anonymous>
(...packages/npm/.build/npm/node_modules/github/index.js:756:21)


My first thought was that I was using a callback somewhere when I was supposed to be using a node-fiber, but the code seems relatively straightforward:



var repos = ['my-repo', 'my-repo-1',];
var pollGit = function() {

repos.forEach(function(repo) {
github.issues.repoIssues({
user: 'user',
repo: repo
}, function(err, stuff) {
if (err) {
throw err;
}
stuff.forEach(function (issue) {
var sel = {git_id: issue.id};
Tasks.find(sel).forEach(function (item) { //ERROR THROWN HERE
console.log('got', item);
});
});
});
});
};

Meteor.startup(function() {
pollGit();
});


This error occurs anytime I try and fetch the actual object after calling find. Just calling find() works fine. What exactly is causing the error?


More From » node.js

 Answers
0

Answering my own question in case anyone needs the answer:



Got it working with How to insert in Collection within a Fiber?



Code is as follows:



Fiber = Npm.require('fibers');
var repos = ['my-repo', 'my-repo-1',];
var pollGit = function() {
repos.forEach(function(repo) {
github.issues.repoIssues({
user: 'user',
repo: repo
}, function(err, stuff) {
if (err) {
throw err;
}
stuff.forEach(function (issue) {
var sel = {git_id: issue.id};
Fiber(function() {
Tasks.find(sel).forEach(function (item) { //ERROR THROWN HERE
console.log('got', item);
});
}).run();

});
});
});
};

Meteor.startup(function() {
pollGit();
});

[#45897] Thursday, April 17, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
makaylahk

Total Points: 166
Total Questions: 94
Total Answers: 117

Location: Gabon
Member since Sat, Jul 25, 2020
4 Years ago
;