Has anyone else experienced this? When I try to create a user, e.g.:
Accounts.createUser({email: 'person@site.com', password: 'test'});
It doesn’t return a new user ID, and on the server side I see:
W20160521-00:55:25.576(-7)? (STDERR)
W20160521-00:55:25.577(-7)? (STDERR) undefined:0
W20160521-00:55:25.577(-7)? (STDERR)
W20160521-00:55:25.577(-7)? (STDERR)
W20160521-00:55:25.578(-7)? (STDERR) TypeError: undefined is not a function
I’m completely unable to make an account. Has anyone seen this before, or has any ideas how to even begin figuring out what’s causing it?
1 Like
Try this out, though Im using it with roles.
// run at Meteor app startup
Meteor.startup(function() {
// if users database is empty, seed these values
if(Meteor.users.find().count() < 1) {
// users array
var users = [
// the front desk roles
{ name: 'Daenerys Targaryen', email: 'frontdesk1@gmail.com', password: 'frontdesk1', roles: ['frontdesk'] },
{ name: 'Khal Drogo', email: 'frontdesk2@gmail.com', password: 'frontdesk2', roles: ['frontdesk'] },
// the nurse roles
{ name: 'Arya Stack', email: 'nurse1@gmail.com', password: 'nurse1', roles: ['nurse'] },
{ name: 'Tyrion Lannister', email: 'nurse2@gmail.com', password: 'nurse2', roles: ['nurse'] },
// the doctors roles
{ name: 'Cersei Lannister', email: 'doctor1@gmail.com', password: 'doctor1', roles: ['doctor'] },
{ name: 'Sansa Stack', email: 'doctor2@gmail.com', password: 'doctor2', roles: ['doctor'] },
];
// user creation
_.each(users, function(d) {
// return id for use in roles assignment below
var userId = Accounts.createUser({
email: d.email,
password: d.password,
username: d.email,
profile: {
name: d.name
}
});
// verify user email
Meteor.users.update({ _id: userId }, { $set: { 'emails.0.verified': true } });
// add roles to user
Roles.addUsersToRoles(userId, d.roles);
});
}
});
EDIT: I’ll post this as an issue on GitHub.
I have the exact same issue. It works if I stop and run the app again, but I’m getting this error when I try to create a user or login. Have you find out the reason or solution for this?
It’s a problem with bcrypt
. It doesn’t affect production at all, this only occurs when you run meteor shell
at least once, while using Accounts
.
Not running Meteor shell after a server reboot made the issue go away. Thanks @ffxsam, that’s a really strange one.
1 Like