Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when creating default admin user Error: Match error: Expected string, got object #440

Open
avishaan opened this issue Sep 26, 2016 · 1 comment

Comments

@avishaan
Copy link
Contributor

I get the following error

W20160926-01:09:52.035(-7)? (STDERR) Error: Match error: Expected string, got object
W20160926-01:09:52.035(-7)? (STDERR)     at exports.check (packages/check/match.js:34:1)
W20160926-01:09:52.036(-7)? (STDERR)     at Object.Roles.addUserToRoles (packages/nicolaslopezj_roles/roles_server.js:18:1)
W20160926-01:09:52.036(-7)? (STDERR)     at Object.<anonymous> (packages/orionjs:accounts/accounts_server.js:13:11)
W20160926-01:09:52.037(-7)? (STDERR)     at packages/matb33_collection-hooks/packages/matb33_collection-hooks.js:290:1
W20160926-01:09:52.037(-7)? (STDERR)     at Array.forEach (native)
W20160926-01:09:52.038(-7)? (STDERR)     at Function._.each._.forEach (packages/underscore/underscore.js:105:1)
W20160926-01:09:52.039(-7)? (STDERR)     at after (packages/matb33_collection-hooks/packages/matb33_collection-hooks.js:289:1)
W20160926-01:09:52.039(-7)? (STDERR)     at Object.<anonymous> (packages/matb33_collection-hooks/packages/matb33_collection-hooks.js:304:1)
W20160926-01:09:52.039(-7)? (STDERR)     at Object.CollectionHooks.extendCollectionInstance._.each.collection.(anonymous function) [as insert] (packages/matb33_collection-hooks/packages/matb33_collection-hooks.js:111:1)
W20160926-01:09:52.040(-7)? (STDERR)     at [object Object].insert (packages/mongo/collection.js:528:37)
=> Exited with code: 1

Looking at accounts_server.js https://github.com/orionjs/orion/blob/master/packages/accounts/accounts_server.js#L13 I see that the following line

Roles.addUserToRoles(curUserId, 'admin');

is being passed a user object instead of the userid which means that this line in file roles_server.js causes a failure since it's an object instead of a userid

check(userId, String);
@avishaan
Copy link
Contributor Author

I found a solution here at the repo of the version still under development scorpiusjs/scorpius#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant