Skip to content

Roles.createRole is not a function #403

@zangab

Description

@zangab

Describe the bug

I am not sure if this is a faulty behavior or intended.
I installed the package along with accounts-password and meteor vue. I followed the docs but as soon as I called Roles.createRole(...) the server threw a TypeError saying Roles.createRole is not a function.

So I dumped the Roles variable and saw that there was only a createRoleAsync function present but no createRole. My startup script is async, meaning:

Meteor.startup(async () => {
  // ...
})

The question is now: are the docs wrong? Is this intended?
I saw that in the common.js file there is a createRole function present.

To Reproduce

Install

accounts-password@3.0.0
alanning:roles@4.0.0-rc.2

put this function into the server/main.js

Meteor.startup(async () => {
  Roles.createRole('admin', { unlessExists: true })
})

Expected behavior

Does not throw any error or docs update (place an info somewhere that this can happen).

Screenshots

Bildschirmfoto 2024-08-28 um 09 14 20

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions