Skip to content

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

@avishaan

Description

@avishaan

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions