Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Meteor code must always run within a Fiber" when calling Collection.insert on server
    primarykey
    data
    text
    <p>I have the following code in server/statusboard.js;</p> <pre><code>var require = __meteor_bootstrap__.require, request = require("request") function getServices(services) { services = []; request('http://some-server/vshell/index.php?type=services&amp;mode=json', function (error, response, body) { var resJSON = JSON.parse(body); _.each(resJSON, function(data) { var host = data["host_name"]; var service = data["service_description"]; var hardState = data["last_hard_state"]; var currState = data["current_state"]; services+={host: host, service: service, hardState: hardState, currState: currState}; Services.insert({host: host, service: service, hardState: hardState, currState: currState}); }); }); } Meteor.startup(function () { var services = []; getServices(services); console.log(services); }); </code></pre> <p>Basically, it's pulling some data from a JSON feed and trying to push it into a collection. </p> <p>When I start up Meteor I get the following exception;</p> <pre><code>app/packages/livedata/livedata_server.js:781 throw exception; ^ Error: Meteor code must always run within a Fiber at [object Object].withValue (app/packages/meteor/dynamics_nodejs.js:22:15) at [object Object].apply (app/packages/livedata/livedata_server.js:767:45) at [object Object].insert (app/packages/mongo-livedata/collection.js:199:21) at app/server/statusboard.js:15:16 at Array.forEach (native) at Function.&lt;anonymous&gt; (app/packages/underscore/underscore.js:76:11) at Request._callback (app/server/statusboard.js:9:7) at Request.callback (/usr/local/meteor/lib/node_modules/request/main.js:108:22) at Request.&lt;anonymous&gt; (/usr/local/meteor/lib/node_modules/request/main.js:468:18) at Request.emit (events.js:67:17) Exited with code: 1 </code></pre> <p>I'm not too sure what that error means. Does anyone have any ideas, or can suggest a different approach?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload