Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match error: Expected number, got undefined #114

Closed
sergical opened this issue Jan 8, 2015 · 18 comments
Closed

Match error: Expected number, got undefined #114

sergical opened this issue Jan 8, 2015 · 18 comments

Comments

@sergical
Copy link

sergical commented Jan 8, 2015

I have lib/collections.js

Transfers = new Meteor.Collection('transfers');
Pages = new Meteor.Pagination(Transfers, {
  perPage: 5,
  sort: {
    date: -1
  },
  templateName: 'listTransfers'
});

... some Transfers.allow({})

server/publications.js

Meteor.publish('transfers', function() {
  // return Transfers.find();
  if (this.userId) {
    return Transfers.find({userId: this.userId});
  } else {
    this.ready();
  }
});

listTransfers.html

<template name="listTransfers">
// some html
  {{> pages}}
  {{> pagesNav}}
</template>

I am getting the following error

Exception from sub yM3hezX7b6g6wFMn3 Error: Match error: Expected number, got undefined
I20150107-21:32:16.542(-5)?     at checkSubtree (packages/check/match.js:159:1)
I20150107-21:32:16.542(-5)?     at check (packages/check/match.js:32:1)
I20150107-21:32:16.543(-5)?     at Pages.__Pages.Pages.publish (packages/alethes:pages/lib/pages.coffee:477:5)
I20150107-21:32:16.543(-5)?     at [object Object]._handler (packages/alethes:pages/lib/pages.coffee:136:20)
I20150107-21:32:16.543(-5)?     at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1599:1)
I20150107-21:32:16.544(-5)?     at [object Object]._.extend._runHandler (packages/ddp/livedata_server.js:943:1)
I20150107-21:32:16.544(-5)?     at [object Object].subscriptionProto._runHandler (packages/meteorhacks:kadira/lib/hijack/wrap_subscription.js:12:1)
I20150107-21:32:16.545(-5)?     at [object Object]._.extend._startSubscription (packages/ddp/livedata_server.js:769:1)
I20150107-21:32:16.545(-5)?     at [object Object]._.extend.protocol_handlers.sub (packages/ddp/livedata_server.js:582:1)
I20150107-21:32:16.545(-5)?     at packages/meteorhacks:kadira/lib/hijack/wrap_session.js:69:1
I20150107-21:32:16.558(-5)? Sanitized and reported to the client as: Match failed [400]
@lc3t35
Copy link

lc3t35 commented Jan 13, 2015

+1 Same for me !

@ivankravchenko
Copy link

+1
same error at #111

@sergical
Copy link
Author

hopefully we can see a fix soon 😄

@advany
Copy link

advany commented Jan 24, 2015

any fix? same problem

@kalarani
Copy link

kalarani commented Feb 3, 2015

I had the same problem. There was another message ("Ignoring duplicate publish named 'tasks'") along with this one. Removing the publication for 'tasks' solved this issue for me.

@rclai
Copy link

rclai commented Feb 6, 2015

I get the same error message, but my table seems to still be working fine. However, instead of saying Match error: Expected number, got undefined it says Match error: Expected number, got string

@rclai
Copy link

rclai commented Feb 6, 2015

For anyone interested I created a patch to get rid of the error here.

@rclai
Copy link

rclai commented Feb 6, 2015

Using my DDP inspector, I saw the root problem:

Initially Pages is sending this subscription with the first parameter as a String. Also I have no idea what that '18963' number represents. It's not the number of documents in my collection.

Object {
   msg: "sub", 
   id: "zDWQYwPeHCZmjPYKD", 
   name: "purchaseOrders",  // my collection name
   params: Array[2]
       [
          0: "18963"
          1: undefined
       ]
}

@advany
Copy link

advany commented Feb 7, 2015

Rclai! you rock :) Hope this gets merged back in soon

@advany
Copy link

advany commented Feb 15, 2015

to bad this didn't got included in the latest version

@rclai
Copy link

rclai commented Feb 15, 2015

Did he fix the issue in his new update, or is the issue still there?

@vladholubiev
Copy link

+1
Faced this issue just now. Any workaround?

@rclai
Copy link

rclai commented Feb 16, 2015

I guess you can try and use my patch I mentioned above.

@vladholubiev
Copy link

@rclai I am new to Meteor and not sure what to do with your code snippet.

@rclai
Copy link

rclai commented Feb 16, 2015

In your app root folder, create a packages folder, and inside of that folder, git clone this repo, you will notice your app start rebuilding, that means that Meteor will now look at that folder as the new location where the alethes:pages package lives. Then go to my patch, and apply the code in my patch into the lib/pages.coffee file around line 498. Does that make sense?

@vladholubiev
Copy link

@rclai, definetly yes. Thank you, finally figered it out. Why don't you make that patch as pull request?

@rclai
Copy link

rclai commented Feb 16, 2015

Okay cool. I didn't want to make it a pull request because it's a patch job and thought that @alethes might have a more appropriate fix unless he thinks it's appropriate enough and asks to make it a pull request.

@alethes
Copy link
Owner

alethes commented Feb 22, 2015

It might have had something to do with defining the publication with the same name as one defined automatically by Pages. In the recent versions, the default publication name is "pages_{{collection_name}}". Previously, it was just the collection name. Usually, there's no need to define a separate publication on the paginated collection, unless you want to use it outside Pages.

GiraffeSlacks referenced this issue in Profab/meteor-pages Feb 26, 2015
@alethes alethes closed this as completed Mar 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants