Lepozepo / meteor-publish-with-relations

Meteor.js SmartPackage to publish associated collections at once.
https://atmospherejs.com/lepozepo/publish-with-relations
11 stars 4 forks source link

Internal server error when using with subs-manager #3

Open lorensr opened 9 years ago

lorensr commented 9 years ago

I haven't yet noticed it affecting functionality.

#client
home_subs = new SubsManager
  cacheLimit: 9999
  expireIn: 9999

home_subs.subscribe 'friends'

#server
Meteor.publish 'friends', ->
  Meteor.publishWithRelations ...

https://github.com/meteorhacks/subs-manager

image

No error is logged server-side.

lorensr commented 9 years ago

Could be related: also can't publish multiple publishWithRelations in one publication:

Meteor.publish 'friends', ->
  [
    Meteor.publishWithRelations ...
    Meteor.publishWithRelations ...
  ]

image

Lepozepo commented 9 years ago

Haha, yeah, it does work with subs manager the problem is how the publisher is formed. If you want to use multiple ones you need to do something like this:

Meteor.publish "friends", ->
  Meteor.publishWithRelations
    _noReady:true
  Meteor.publishWithRelations

  @ready()

It's not documented yet since it's the way the original package worked. I'll add it to the docs though.

lorensr commented 9 years ago

Your second call doesn't have the _noReady arg – in general, only the first call to publishWithRelations should have the _noReady:true, or all the but the last call?

Lepozepo commented 9 years ago

Everything except the last unless you're returning @ready() at the end then you could have _noReady:true on all of them

lorensr commented 9 years ago

Got it. Multiple .publishWithRelations per .publish is working, however I still get the same original Internal server error when using with SubsManager.

Lepozepo commented 9 years ago

Weird, are you sure you're doing home_subs.subscribe 'friends' and not SubsManager.subscribe 'friends'?

lorensr commented 9 years ago

Yep! Not sure how to further diagnose, since the client-side error is non-descriptive, and there's no error printed server-side – I guess subs-manager must be catching the error?

On Thu, May 21, 2015 at 11:57 PM, Marcelo Reyna notifications@github.com wrote:

Weird, are you sure you're doing home_subs.subscribe 'friends' and not SubsManager.subscribe 'friends'?

— Reply to this email directly or view it on GitHub https://github.com/Lepozepo/meteor-publish-with-relations/issues/3#issuecomment-104541381 .

Lepozepo commented 9 years ago

Weird, I'll test when I get a chance to see if it's on our side.