Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Meteor.userId throwing error on method call #125

Open
nelson-uruworks opened this issue Nov 15, 2016 · 12 comments
Open

Meteor.userId throwing error on method call #125

nelson-uruworks opened this issue Nov 15, 2016 · 12 comments

Comments

@nelson-uruworks
Copy link

Hi, I'm using simple:rest-accounts-password to authenticate the users, and when I make a call to one of my methods that makes use of Meteor.userId() using POST to /methods/myMethodName I get the following exception:

Meteor.userId can only be invoked in method calls. Use this.userId in publish functions.

If I use this.userId, I get a correct identification, but that shouldn't be the way of using it inside a meteor method. Am I missing something? Thank you.

@dpatte
Copy link

dpatte commented Nov 15, 2016

I also have this issue. See #54

@nelson-uruworks
Copy link
Author

oh okay I see, thank you for replying

@dpatte
Copy link

dpatte commented May 22, 2017

there is a pull request which resolves this issue

@thearabbit
Copy link

I have the same problem.
Has any solve?

@dpatte
Copy link

dpatte commented Jun 15, 2017

yes, the pull request solves this issue.

@thearabbit
Copy link

Merge already? I still have this problem.

@dpatte
Copy link

dpatte commented Jun 16, 2017

the pull request means that it is not yet merged. you will have to merge it yourself locally or wait for it to be merged.

@thearabbit
Copy link

Thanks again, what #... of pull?

@MileanCo
Copy link

MileanCo commented Oct 13, 2017

Also having this issue... any ideas?? WE only use OAuth logins - Facebook and Spotify currently.
Adding the simple:rest-accounts-password package didnt fix it. Using simple:rest 1.1.1

@jmarks-joshua
Copy link

This issue still hasn't been resolved. For those wondering why, it is essentially stuck on an old meteor method api whereby instead of allowing Meteor.user() or Meteor.userId() to be resolved it instead is setting this.userId. So you can use this.userId in the meantime, but not ideal if you want your methods to also work as normal methods.

@convexset
Copy link

Is this going to be merged soon?

@convexset
Copy link

I notice that Fiber.current._meteorDynamics is not defined so a quick hack would not be possible.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants