[Error: Can't wait without a fiber] when calling Meteor.users.findOne()


I’m consuming a message from RabbitMQ and then want to send a push notification to APNS/GSM using raix-push plugin. I have RabbitMQ integrated with Meteor but when I try to query the user’s record for their _id (required for raix-push), it gives this exception:

W20150930-16:03:53.929(-7)? (STDERR) Error: [Error: Can't wait without a fiber]
W20150930-16:03:53.929(-7)? (STDERR)     at Connection.<anonymous> (packages/jakobloekke_rabbitmq/packages/jakobloekke_rabbitmq.js:20:1)
W20150930-16:03:53.929(-7)? (STDERR)     at Connection.emit (events.js:117:20)
W20150930-16:03:53.929(-7)? (STDERR)     at Connection.<anonymous> (/Users/lsacco/.meteor/packages/jakobloekke_rabbitmq/.
W20150930-16:03:53.930(-7)? (STDERR)     at Connection.emit (events.js:95:17)
W20150930-16:03:53.930(-7)? (STDERR)     at CleartextStream.emit (events.js:95:17)
W20150930-16:03:53.933(-7)? (STDERR)     at CleartextStream.<anonymous> (_stream_readable.js:765:14)
W20150930-16:03:53.933(-7)? (STDERR)     at CleartextStream.emit (events.js:92:17)
W20150930-16:03:53.933(-7)? (STDERR)     at emitReadable_ (_stream_readable.js:427:10)
W20150930-16:03:53.933(-7)? (STDERR)     at _stream_readable.js:420:7
W20150930-16:03:53.933(-7)? (STDERR)     at process._tickCallback (node.js:448:13)

I’ve tried many different things to such as wrapping as Fiber, using Meteor.bindEnivornment and the approach mentioned here. Any idea what I’m missing here?

    RabbitMQ.connection.on('ready', function () {
        RabbitMQ.connection.queue('ma.services.gapns', {'durable': true, 'autoDelete': false, closeChannelOnUnsubscribe: true }, function (queue) {
                queue.bind('ma.integration.exchange', 'gapns');
                queue.subscribe(function (msg) {
                    var data = {};
                    if (msg.content) {
                        data = msg.content;
                    var uid = data.uid,
                        system = data.system,
                        count = data.count;
                    if (uid && system && count >= 0) {
                        var user = getUser(uid);

                            from: 'push',
                            title: 'Hub Notification',
                            text: system + " request(s) to approve",
                            badge: count,
                            sound: 'ping.aiff',
                            query: {
                                userId: user._id

            catch (e) {
                logger.error("Exception occurred while processing push notifications: " + e);

function getUser(uid) {
    var Future  = Npm.require('fibers/future');
    var future = new Future();
    Meteor.users.findOne({username: uid}, {}, function(err, result) {
        if (err) {

    return future.wait();


Anyone have a suggestion how to do this without blocking Meteor startup?


You may need to wrap the connection.on callback in a Meteor.bindEnivornment

RabbitMQ.connection.on('ready', Meteor.bindEnivornment(function () {}))


Yup, it looks like that does the trick but I also had to add Meteor.bindEnvironment() to the callback function for queue.subscribe and connection.queue too. That eluded me because I thought if the top level function had it, I’d be ok.