peerlibrary / meteor-user-extra

Extended Meteor.userId() and Meteor.user()

Home Page:https://atmospherejs.com/peerlibrary/user-extra

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception in defer callback: Error: Meteor.userId() not invoked from a method or publish function.

hems opened this issue · comments

After updating meteor i have been having this Meteor.userId() issue in one of my projects, after searching i found out this library aims to solve the issue, unfortunately after installing the library the error just shifted from one place to another.

here is the current error:

I20170508-18:24:45.589(1)? Exception in defer callback: Error: Meteor.userId() not invoked from a method or publish function.
I20170508-18:24:45.590(1)?     at Object.Meteor.userId (packages/peerlibrary_user-extra/server.coffee:10:13)
I20170508-18:24:45.591(1)?     at Object.Meteor.user (packages/peerlibrary_user-extra/lib.coffee:7:20)
I20170508-18:24:45.591(1)?     at server/methods/cards/new.js:24:63

and here is without meteor-user-extra installed:

I20170508-18:28:03.389(1)? Exception in defer callback: Error: Meteor.userId can only be invoked in method calls. Use this.userId in publish functions.
I20170508-18:28:03.390(1)?     at AccountsServer.userId (packages/accounts-base/accounts_server.js:82:13)
I20170508-18:28:03.391(1)?     at AccountsServer.user (packages/accounts-base/accounts_common.js:58:23)
I20170508-18:28:03.391(1)?     at Object.Meteor.user (packages/accounts-base/accounts_common.js:266:19)
I20170508-18:28:03.391(1)?     at server/methods/cards/new.js:24:63

turns out i had a defer and i didn't notice and that was the issue.

still i'll use the package due to it's capabilities, thanks a lot for that.

commented

I am glad you solved your problem. :-)