redis-oplog
redis-oplog copied to clipboard
Meteor.userId can only be invoked in method calls or publications.
I am on Meteor 1.12.1 using [email protected] Without Oplog this works fine, with oplog i see hundreds of errors in Kadira with the error message
message: Meteor.userId can only be invoked in method calls or publications. stack:
Error: Meteor.userId can only be invoked in method calls or publications.
I see there is already a closed issue for this: here
Could this have been reproduced? should i use an older version of this package?
Issues include as much detail as possible:
- [ ] A descriptive title
- [ ] A description of the problem you're trying to solve, including why you think this is a problem
- [ ] An overview of the suggested solution (if you have an idea)
- [ ] If the feature changes current behavior, reasons why your solution is better
- [ ] Provide with an example of the publication and the mutation that you do
- [ ] Enabled "debug" inside the package and show us some meaningful logs
Show us your publish function please!
@theodorDiaconu for us the problem exists because we apply a Tenant scope to (most of) our Collections, which relies on Meteor.userId().
The following part of the code is not executed within the scope of the (first) Subscription:
https://github.com/cult-of-coders/redis-oplog/blob/master/lib/cache/ObservableCollection.js#L71
Hence it does not have a DDP._CurrentPublicationInvocation.get(), which results in the error @amsinha2 mentioned above.
I'm not sure how to proceed in resolving this; could we run this find after the (first) Subscription is executed?