Problem with 2.7.2 and publications? [SOLVED]

I just upgraded to 2.7.2 and one of my publications has stopped working. Stopped working in that it never comes ready. The publication is simple enough

Meteor.publish('guides.practices', () => {
  return [
    Practices.find({}, { fields: { 'buyers-guide': 1, 'sellers-guide': 1, state: 1 } }),
  ]
})

The subscription is simply

  const subsHandle = Meteor.subscribe('guides.practices')

The publication runs ok (I put a console.log there), and I even tried removing the fields object, and returning the data instead of returning an array.

I tried reverting to mongo@1.14.6 (it was 1.15), but with no success. It looks like it’s something in the Meteor core that’s upsetting it.

Other subscriptions are working ok. I am baffled.

I also tried just hacking the .meteor/release file back to 2.7.1 - it failed to start, and highlighted the packages I am using:

 Errors prevented startup:

   While selecting package versions:
   error: Conflict: Constraint mongo@1.15.0 is not satisfied by mongo 1.14.6.
   Constraints on package "mongo":
   * mongo@1.14.6 <- top level
   * mongo@~1.14.6 <- top level
   * mongo@1.10.1 || 1.12.0 <- aldeed:collection2 3.5.0
   * mongo@1.15.0 <- accounts-base 2.2.3
   * mongo@1.13.0 <- service-configuration 1.3.0
   * mongo@1.0.8 <- dburles:mongo-collection-instances 0.3.6
   * mongo@1.0.6 || 1.12.0 <- lai:collection-extensions 0.3.0 <-
   dburles:mongo-collection-instances 0.3.6
   * mongo@1.1.5 <- xolvio:cleaner 0.4.0
   * mongo@1.10.1 || 1.12.0 <- alanning:roles 3.4.0
   * mongo@1.14.6 <- oauth 2.1.2 <- accounts-oauth 1.4.1 <- accounts-facebook 1.3.3
   * mongo@1.14.6 <- oauth 2.1.2 <- bozhao:link-accounts 2.6.1
   * mongo@1.13.0 <- oauth1 1.5.0 <- twitter-oauth 1.3.0 <- accounts-twitter 1.5.0
   * mongo@1.6.2 <- reactive-dict 1.3.0 <- session 1.2.0
   * mongo@1.1.5 <- johanbrook:publication-collector 1.1.0
   * mongo@1.10.0 <- mikowals:batch-insert 1.3.0
   * mongo@1.10.1 || 1.12.0 <- matb33:collection-hooks 1.1.2

=> Your application has errors. Waiting for file change.

Does anyone have an idea how to trouble shoot this?

“Fat arrow” should not be uses in publications. Try

Meteor.publish('guides.practices', function() {

Unfortunately not that easy. Even doing as you suggest didn’t fix it. Other fat arrow functions were working ok. It’s strange that only this one is broken

Arrow functions are not the the causes but I agree with @robfallows, we should use function() { in order to access to the context via this variable.

Ok, I worked it out. The withTracker function was using a React.useState hook - which caused an exception. Somehow the switch to Meteor 2.7.2 exposed this problem.

All good now

3 Likes