Meteor Call - Exception in template helper


#1

I’m trying to make a method call in client, but I get
Exception in template helper: Error: Syntax error, unrecognized expression: https://www.example.com
I’m using a Meteor method to parse a URL in XML to get some data, so my variable is a string URL

Method

rank: function(postAttributes) {
        check(postAttributes, {
          url: String
        });
        var alexa = require('alexarank');
        var alexaSync = Meteor.wrapAsync(alexa);
        var result = alexaSync({url: postAttributes.url});
        return result.rank;
      }

Client Call

function() {
        var a = document.createElement('a');
        a.href = this.url;
         var post = {
          url: $(a.href)
        };
        Meteor.call('rank', post, function(error, result) {
          // display the error to the user and abort
          if (error)
            return throwError(error.reason);
          // show this result but route anyway
          return result;
        });
      }

Any idea?


#2

Is it this module? https://www.npmjs.com/package/alexarank
Seems to me it just wants an url, a string, not an object?


#3

That won’t return anything from your wrapper function, which is always returning undefined at the moment. I’m not sure what you’re trying to do here - the error you’ve quoted says it’s in a template helper - can you show us the code for your helper?