It does not work for the automated publications for users
theodorDiaconu opened this issue · comments
I20180109-18:04:02.592(2)? no invoke, CursorDescription {
I20180109-18:04:02.592(2)? collectionName: 'users',
I20180109-18:04:02.592(2)? selector: { _id: 'jzsdfPdbjBMdAedPg' },
I20180109-18:04:02.592(2)? options:
I20180109-18:04:02.592(2)? { transform: null,
I20180109-18:04:02.592(2)? fields: { profile: 1, username: 1, emails: 1 } } }```
When that publication entry is created it does not put it inside DDP._CurrentPublish.get()
Any clues why ?
What is "automated publications for users"? Can you share some code?
BTW, in Meteor >= 1.5.1 this package does not do anything anymore because there is official support for this. So it might be interesting to see if your bug also exists in Meter < 1.5.1. Because maybe then putting this feature into core Meteor was not done properly.
But at the moment I do not understand your issue at all. :-)
Sorry for being unclear @mitar . Basically it's related to the fact that Meteor auto publishes email,profile,id,username from the user. Well... that publication context does not contain the connection, so I can extract the id
of it! But this happens with their DDP._CurrentPublicationInvocation
also, so it's a Meteor issue, or something I don't understand.
Ehm, but that auto publish is an already written code. :-) Where are you extracting that code? When you are monkey patching things?
But I do not see why it would not be set. The order of things how I see it is:
- startUniversalSubs: https://github.com/meteor/meteor/blob/devel/packages/ddp-server/livedata_server.js#L406
- _startSubscription: https://github.com/meteor/meteor/blob/devel/packages/ddp-server/livedata_server.js#L849
- _runHandler: https://github.com/meteor/meteor/blob/devel/packages/ddp-server/livedata_server.js#L1031
- and it sets _CurrentPublicationInvocation: https://github.com/meteor/meteor/blob/devel/packages/ddp-server/livedata_server.js#L1041
@mitar this is on redis-oplog, I'm basically oxtending Meteor.publish, and I notice that my observers do not have the connection property set, I will have to dig deeper. Thank you for the links you provided, it's a very strange issue.
Are you running them in a new fiber? You should probably then copy all EnvironmentVariable
s over. But I am not sure what happens if then user logs out, are they all updated? Tricky tricky.
No new fiber is involved when creating the publications, so that shouldn't affect. User logging out calls the subscription methods again so we're fine on that part. Tricky indeed, there are so many factors involved it's easy to get lost, but I'll find a way.
Good luck. I know how it is in those trenches. :-)