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

Meteor.userId can only be invoked in method calls or publications. #369

Open
6 tasks
amsinha2 opened this issue Jan 30, 2021 · 2 comments · May be fixed by #383
Open
6 tasks

Meteor.userId can only be invoked in method calls or publications. #369

amsinha2 opened this issue Jan 30, 2021 · 2 comments · May be fixed by #383

Comments

@amsinha2
Copy link

I am on Meteor 1.12.1 using redis-oplog@2.0.5
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
@theodorDiaconu
Copy link
Contributor

Show us your publish function please!

@KoenLav
Copy link

KoenLav commented Oct 2, 2021

@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?

@KoenLav KoenLav linked a pull request Oct 6, 2021 that will close this issue
@StorytellerCZ StorytellerCZ linked a pull request Oct 7, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants