chimp: server.call('xxxxxx') errors out with "text.split is not a function"

Meteor 1.2.1 + chimp

// tests/cucumber/step_definitions/steps.js
(function() {
    modules.export = function() {
        this.Given(/^I am an unauthenticated user$/, function () {
            server.call("fixtures/logout");
        });
    }
})();
// packages/fixtures/fixtures.js
Meteor.methods({
    'fixtures/logout': function() {
        Meteor.logout();
    }
});
// packages/fixtures.package.js
Package.describe({
  name: 'awesome:fixtures',
  version: '0.0.1',
  summary: '',
  debugOnly: true
});

Package.onUse(function(api) {
  api.versionsFrom('1.2.1');
  api.use('ecmascript');
  api.addFiles('fixtures.js', 'server');
});

The tests error out with this:

[chimp] Detected an unhandledRejection.
[chimp][hooks] Reason:
[chimp][hooks] text.split is not a function

The fixtures package has been added to my project and I’ve tried variations of the call like this.server.call, return server.call, return this.server.call.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 17 (6 by maintainers)

Most upvoted comments

Hey @zvictor

I’ll work on this today. Thank you for the reminder!

This should be fixed now in the newest version of xolvio/node-ddp-client. Please run npm update in your chimp directory so the dependency gets upgraded.

I am having the same problem and it happens when the method throws a Meteor.Error (JS’s Error works fine).

code

// step definition
(function() {
    modules.export = function() {
        this.Given(/^bla bla bla$/, function () {
            server.call('myMethod', 'justAnArgument');
        });
    }
})();
// method definition
Meteor.methods({
    'myMethod': function(aParameter) {
        console.log(aParameter);
        throw new Meteor.Error('I hope you can read me on the other side...');
    }
});

log

I20160413-10:22:16.103(2)? justAnArgument
    Given bla bla bla
[chimp] Detected an unhandledRejection:
[chimp][hooks] TypeError: text.split is not a function
    at /Users/zvictor/development/network/.scripts/node_modules/meteor-promise/fiber_pool.js:33:40

Looks like if you comment out line 160 in
node_modules/chimp/node_modules/xolvio-ddp/lib/ddp-client.js

https://github.com/xolvio/node-ddp-client/blob/master/lib/ddp-client.js#L160

the cucumber is able to properly parse the error object, it gets the error message from the stack. Otherwise it tries to do split on something it thinks is a text (hence text.split is not a function).

I’m not sure why the delete was happening there, I’ll talk with @samhatoum and/or @Sanjo about this and should have a real solution quickly, meanwhile - if this was a show stopper please comment out that line and let us know if this is still a problem or if it caused a different one. 😉

screen shot 2016-06-29 at 3 13 13 pm