Meteor 1.3, React and current user problems


Edit: I just needed to add the accounts-base package. D’oh!

I have this simple container:

import { Meteor } from 'meteor/meteor';
import { createContainer } from 'meteor/react-meteor-data';
import AppLayout from '/imports/ui/layouts/AppLayout.jsx';

export default createContainer(({ params }) => {
  const currentUser = Meteor.userId();

  return {
}, AppLayout);

And this is the error I get:

Uncaught TypeError: _meteor.Meteor.userId is not a function

But in WebStorm, I can CMD+click the userId() function and go to the definition just fine.

Any tips?


According to this, it should be working just fine, right?


Excuse my d’oh moment. I needed to add the accounts-base package.


Hahaha, just started a new app some days ago and had the exact same problem :smile: That’s something I’ll probably forget about again, until I start the next app :yum:


I added the accounts-base package but still keep getting this same error. Does anyone have any advice? I’m brand new tbh


I’m into my gazillionth app and there are oh god so very inexplicably trivial things that I need to check and fix every! single! time! :smiley: