javascript - Meteor JS - Exception from sub id (id that does not exist) -


i20150615-07:11:17.859(9)? exception sub draftslist id gghnkqkdjnstyhuqs error: match error: expected object, got undefined i20150615-07:11:17.859(9)? @ checksubtree (packages/check/match.js:275:1) i20150615-07:11:17.859(9)? @ check (packages/check/match.js:32:1) i20150615-07:11:17.859(9)? @ [object object].meteor.publish.meteor.users.find.userid [as _handler] (app/server/publications.js:44:3) i20150615-07:11:17.859(9)? @ maybeauditargumentchecks (packages/ddp/livedata_server.js:1617:1) i20150615-07:11:17.859(9)? @ [object object]._.extend._runhandler (packages/ddp/livedata_server.js:950:1) i20150615-07:11:17.859(9)?
@ [object object]._.extend._startsubscription (packages/ddp/livedata_server.js:769:1) i20150615-07:11:17.859(9)?
@ [object object]._.extend.protocol_handlers.sub (packages/ddp/livedata_server.js:582:1) i20150615-07:11:17.859(9)?
@ packages/ddp/livedata_server.js:546:1 i20150615-07:11:17.860(9)? sanitized , reported client as: match failed [400]

i working on meteor project , i'm getting weird error on terminal.

the problem when says exception sub draftslist id gghnkqkdjnstyhuqs error: match error: expected object, got undefined, id changes on page refresh, , not in database (nowhere seen).

the thing is, works find..

here publication-subscription

publication

meteor.publish('draftslist', function (options) {      check(this.userid, string);   check(options, {     limit: number   });    var drafts = drafts.find({'user._id': this.userid}, options);    return drafts; }); 

subscription

router.route('/posts/:_id', {   name: 'postpage',   // limit: function () {   //   return   // }   subscriptions: function () {     return [       meteor.subscribe('singlepost', this.params._id),       meteor.subscribe('userstatus'),       meteor.subscribe('draftslist'),       meteor.subscribe('draftslist', {         limit: number(session.get('draftslimit'))       }),       meteor.subscribe('comments', {           postid: this.params._id         }, {           limit: number(session.get('commentlimit'))       }),       meteor.subscribe('answers', {           postid: this.params._id         }, {           limit: number(session.get('answerlimit'))       })     ];   },   data: function() {     return posts.findone({_id:this.params._id});    }, }); 

you subscribing draftslist twice in route. first subscription without parameters, make options undefined instead of object. remove first subscription , problem should go away.

also note using check this.userid may work in case cause problems if using waiton in route. accepted pattern return [] or this.ready() when this.userid undefined in publisher requires authenticated client.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -