{"action":"created","issue":{"url":"https://api.github.com/repos/alanning/meteor-roles/issues/139","labels_url":"https://api.github.com/repos/alanning/meteor-roles/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/alanning/meteor-roles/issues/139/comments","events_url":"https://api.github.com/repos/alanning/meteor-roles/issues/139/events","html_url":"https://github.com/alanning/meteor-roles/issues/139","id":113031819,"number":139,"title":"error when  user  addUsersToRoles","user":{"login":"ahmedrabie","id":6094675,"avatar_url":"https://avatars.githubusercontent.com/u/6094675?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmedrabie","html_url":"https://github.com/ahmedrabie","followers_url":"https://api.github.com/users/ahmedrabie/followers","following_url":"https://api.github.com/users/ahmedrabie/following{/other_user}","gists_url":"https://api.github.com/users/ahmedrabie/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedrabie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedrabie/subscriptions","organizations_url":"https://api.github.com/users/ahmedrabie/orgs","repos_url":"https://api.github.com/users/ahmedrabie/repos","events_url":"https://api.github.com/users/ahmedrabie/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedrabie/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-23T14:33:37Z","updated_at":"2015-10-23T21:13:40Z","closed_at":"2015-10-23T21:13:40Z","body":"if (Meteor.isServer) {\r\nfunction creatuser_account(username,email){\r\n var options = {\r\n      username: username, \r\n      password: '123456', \r\n      email:email\r\n    };\r\n\r\nAccounts.createUser(options, function (err) {\r\n  if (err) {\r\n    alert(err.reason)\r\n  } else {\r\n var newUserId = Meteor.userId();\r\n     Roles.addUsersToRoles(newUserId,'member');\r\n\r\n  }\r\n});\r\n\r\n}\r\nwhen i try to use this  i get   error like this :\r\ninsert failed: MongoError: E11000 duplicate key error index: meteor.roles.$name_1  dup key: { : \"member\" } undefined\r\ndebug.js:43 update failed: Access denied undefined"},"comment":{"url":"https://api.github.com/repos/alanning/meteor-roles/issues/comments/150694085","html_url":"https://github.com/alanning/meteor-roles/issues/139#issuecomment-150694085","issue_url":"https://api.github.com/repos/alanning/meteor-roles/issues/139","id":150694085,"user":{"login":"alanning","id":749324,"avatar_url":"https://avatars.githubusercontent.com/u/749324?v=3","gravatar_id":"","url":"https://api.github.com/users/alanning","html_url":"https://github.com/alanning","followers_url":"https://api.github.com/users/alanning/followers","following_url":"https://api.github.com/users/alanning/following{/other_user}","gists_url":"https://api.github.com/users/alanning/gists{/gist_id}","starred_url":"https://api.github.com/users/alanning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alanning/subscriptions","organizations_url":"https://api.github.com/users/alanning/orgs","repos_url":"https://api.github.com/users/alanning/repos","events_url":"https://api.github.com/users/alanning/events{/privacy}","received_events_url":"https://api.github.com/users/alanning/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T21:13:40Z","updated_at":"2015-10-23T21:13:40Z","body":"The snippet you provided doesn't compile and I'm having trouble reproducing the error. \r\n\r\nRe-open this ticket once you've got a public reproduction available on github for me to look at.\r\n\r\n(Btw, `Accounts.createUser` can't be called on the server with a callback.)"}}