Apollo mutation + Accounts.createUser = Boom!

Im trying to do simple enrollmente process with apollo mutation.
let userId = Accounts.createUser({email, username: email});
Accounts.sendEnrollmentEmail(userId);
return {
code: 200,
message: bla bla bla
}

inside a mutation. But i got this error: Meteor.userId can only be invoked in method calls or publications.
So i have to use method instead of mutaiton? any idea?

and by calling a method, that method goes in loop… yeahhhhh

Can you please paste here the full resolver code for that mutation.

well, its not the problem of mutation, the exception is launched on Accounts.createUser, becouse i skipped the doc which suggested to use nicolaslopezj:apollo-accounts, ooops.

Sorry, i found the problem, i bound a function to Accounts.onCreateUser which gave me that exception, so nicolaslopezj:apollo-accounts was not necessary. Shame on me. :expressionless:

1 Like

Hey we all make so much sillier mistakes, don’t beat yourself for this :slight_smile:

1 Like