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

Roles.createRole is not a function #403

Open
zangab opened this issue Aug 28, 2024 · 4 comments
Open

Roles.createRole is not a function #403

zangab opened this issue Aug 28, 2024 · 4 comments
Labels

Comments

@zangab
Copy link

zangab commented Aug 28, 2024

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

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

@zangab zangab added the bug label Aug 28, 2024
Copy link

Thank you for submitting this issue!

We, the Members of Meteor Community Packages take every issue seriously.
Our goal is to provide long-term lifecycles for packages and keep up
with the newest changes in Meteor and the overall NodeJs/JavaScript ecosystem.

However, we contribute to these packages mostly in our free time.
Therefore, we can't guarantee your issues to be solved within certain time.

If you think this issue is trivial to solve, don't hesitate to submit
a pull request, too! We will accompany you in the process with reviews and hints
on how to get development set up.

Please also consider sponsoring the maintainers of the package.
If you don't know who is currently maintaining this package, just leave a comment
and we'll let you know

@demangejeremy
Copy link

Same problem for me. I'm trying to solve this last problem before migrating to Meteor v3.

@zangab
Copy link
Author

zangab commented Aug 28, 2024

@demangejeremy The fix is actually quite easy with await Roles.createRoleAsync(...) but it's irritating if the docs state otherwise. That's why I try to reach out to some maintainers :)

@demangejeremy
Copy link

Thanks a lot @zangab, that's what I realized right after I sent my message. Indeed, it's confusing.

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

No branches or pull requests

2 participants