"must always run within a Fiber” when using Meteor.runAsync


Using cassandra with meteor.

let client = new cassandra.Client({contactPoints: [cassandraHost]});

var cassandraExecSync = Meteor.wrapAsync(client.execute, client);
MyProject.Feed.CassandraMeteorWrap = {
insertNewPost: function (userId, postContentJson, relevance) {
       var insertCommand = insert(userId, postContentJson, relevance);
       try {
           return cassandraExecSync(insertCommand);
       } catch (err) {
           console.log("error inserting: " + insertCommand);

So I wrapped Cassandra.client.execute (which has last arg as callback) with Meteor.wrapAsync

The first few inserts work, but after a few inserts (the insert is being called periodically) I get a:

Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.

Update: Debug meteor showed the stack trace and the exception starts from the npm package I use “cassandra-driver” on the .onTimeout():

function listOnTimeout() {
  var msecs = this.msecs;
  var list = this;

  debug('timeout callback ' + msecs);

  var now = Timer.now();
  debug('now: %d', now);

  var first;
  while (first = L.peek(list)) {
    // If the previous iteration caused a timer to be added,
    // update the value of "now" so that timing computations are
    // done correctly. See test/simple/test-timers-blocking-callback.js
    // for more information.
    if (now < first._monotonicStartTime) {
      now = Timer.now();
      debug('now: %d', now);

    var diff = now - first._monotonicStartTime;
    if (diff < msecs) {
      list.start(msecs - diff, 0);
      debug(msecs + ' list wait because diff is ' + diff);
    } else {
      assert(first !== L.peek(list));

      if (!first._onTimeout) continue;

      // v0.4 compatibility: if the timer callback throws and the
      // domain or uncaughtException handler ignore the exception,
      // other timers that expire on this tick should still run.
      // https://github.com/joyent/node/issues/2631
      var domain = first.domain;
      if (domain && domain._disposed) continue;
      try {
        if (domain)
        var threw = true;
        if (domain)
        threw = false;
      } finally {
        if (threw) {
          // We need to continue processing after domain error handling
          // is complete, but not by using whatever domain was left over
          // when the timeout threw its exception.
          var oldDomain = process.domain;
          process.domain = null;
          process.nextTick(function() {
          process.domain = oldDomain;

  debug(msecs + ' list empty');
  delete lists[msecs];