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

[rbac-backend] Error: Plugin 'permission' is already registered #2082

Closed
gluckzhang opened this issue Aug 23, 2024 · 3 comments
Closed

[rbac-backend] Error: Plugin 'permission' is already registered #2082

gluckzhang opened this issue Aug 23, 2024 · 3 comments
Labels
jira kind/bug Something isn't working status/triage

Comments

@gluckzhang
Copy link

Describe the bug

As mentioned in the documentation here, we need to set up the Backstage permission framework first.

For the new Backend system, I added the following code to packages/backend/src/index.ts:

backend.add(import('@backstage/plugin-permission-backend/alpha'));
backend.add(import('@janus-idp/backstage-plugin-rbac-backend'));

When run yarn dev from the root folder, I get the following error:

[1]             throw new Error(`Plugin '${r.pluginId}' is already registered`);
[1]                   ^
[1] Error: Plugin 'permission' is already registered

I find that both @backstage/plugin-permission-backend/alpha and @janus-idp/backstage-plugin-rbac-backend use the same plugin id (permission), but I am not sure about how to fix it.

Expected Behavior

Backstage is up and running.

What are the steps to reproduce this bug?

  1. Follow the example here to setup Backstage permission framework
  2. Add @janus-idp/backstage-plugin-rbac-backend
  3. run yarn dev from the root folder

Versions of software used and environment

  • Backstage 1.27.0
  • @backstage/plugin-permission-backend 0.5.42
  • @janus-idp/backstage-plugin-rbac-backend@npm 4.10.0
@gluckzhang gluckzhang added kind/bug Something isn't working status/triage labels Aug 23, 2024
@github-actions github-actions bot added the jira label Aug 23, 2024
@gluckzhang
Copy link
Author

Hi again, after a bit more exploration, I think only adding backend.add(import('@janus-idp/backstage-plugin-rbac-backend')); is sufficient because the documentation also mentions that "this plugin provides a dynamic policy that replaces the traditional one, there's no need to create a policy manually."

In the beginning, the only misleading part to me is that we need to set up the Backstage permission framework first, while Backstage documentation says I need to add backend.add(import('@backstage/plugin-permission-backend/alpha')); in order to enable the permission framework.

Please correct me if the interpretation above is wrong. Furthermore, great job on this RBAC plugin. I see that it also uses Casbin as the rule engine, which is very cool. Thanks!

@PatAKnight
Copy link
Member

Sorry for just now getting back to you on this. You are correct that it is misleading and that you only need backend.add(import('@janus-idp/backstage-plugin-rbac-backend'));, the docs haven't been updated completely to reflect the new changes that have been made to Backstage. I'll make some time to review the Setup Permission Framework section to see if it is still relevant. Thanks for this!

@gluckzhang
Copy link
Author

Sounds great. Thanks @PatAKnight !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira kind/bug Something isn't working status/triage
Projects
None yet
Development

No branches or pull requests

2 participants