-
Bug
-
Resolution: Duplicate
-
Critical
-
None
-
None
-
None
-
False
-
-
False
-
-
Describe the bug
Showcase is returning the following error whenever a user attempts to retrieve the plugin permission policies of a dynamic plugin.
{
"error": {
"name": "SyntaxError",
"message": "Unexpected token < in JSON at position 0",
"stack": ...
}
}
It seems like the problem has to do with line 55 of rbacDynamicPluginsModule.ts in the showcase repo. What is happening is the suffix -backend-dynamic is to be removed from the plugin id so that the rbac plugin can consume it during the well known permissions api calls. However, it seems like this does not always work for dynamic plugins that do not have the suffix -backend-dynamic.
In the reproduction below, I am adding the Kubernetes backend plugin as a dynamic plugin. The name of the plugin ends up being 'backstage-plugin-kubernetes-backend'. After the removals, it will end up being 'kubernetes-backend'.
Expected Behavior
The RBAC plugin should be able to return the permission policies of dynamic plugins.
What are the steps to reproduce this bug?
- Enable the RBAC backend
- Give yourself admin access
- Enable the Kubernetes backend plugin as a dynamic plugin
- Start backstage-showcase
- Retrieve your token
- Attempt to make the following call
curl --location 'http://localhost:7007/api/permission/plugins/policies' \ --header 'Authorization: Bearer XXX'
- Notice the above error