Server Render and Meteor.userId() call


#1

(webapp_server.js:799) Error running template: Error: Meteor.userId can only be invoked in method calls or publications.

I know at this time, it’s not able to get current user session on server render, but to make the server render works with a page which called Meteor.userId() function somewhere is wordy.

for example, in a react component to get user id, I need to do:

const myUserId = Meteor.isServer ? null : Meteor.userId();

Is there anyway to make it better?

By the way, it’s very hard to debug server render error. It just return (print out) Error! string without any information.
I think server render is still a very important part when you build a website. What do you think?
Thank you.