Access control using cerbos throws TypeError: cyclic object value
I am using cerbos for access control and it only checks for dashboard resource all other routes are not checked. Am I missing something? I have followed the example code of cerbos from https://github.com/refinedev/refine/tree/master/examples/access-control-cerbos
This example works fine but when I do same on my project it only checks for dashboard page. Here is my refine
App.tsx
setup for accessControlProvider
GitHub
refine/examples/access-control-cerbos at master ยท refinedev/refine
Build your React-based CRUD applications, without constraints. - refine/examples/access-control-cerbos at master ยท refinedev/refine
20 Replies
Hi, I am refine support bot :wave:. I am here to help you with your question. I searched for the answer to your question in the refine documentation and found an answer! ๐
Answer: It is possible that you are missing something. Refer to the refine Access Control Provider documentation for more information. SOURCES: https://refine.dev/docs/api-reference/core/providers/accessControl-provider/
Answer: It is possible that you are missing something. Refer to the refine Access Control Provider documentation for more information. SOURCES: https://refine.dev/docs/api-reference/core/providers/accessControl-provider/
Note: If this is the answer you need, then we are very lucky. If not, please wait for someone from the refine core team or the community to try to help you.
Access Control Provider | refine
Access control is a broad topic where there are lots of advanced solutions that provide different set of features. refine is deliberately agnostic for its own API to be able to integrate different methods (RBAC, ABAC, ACL, etc.) and different libraries (Casbin, CASL, Cerbos, AccessControl.js). can method would be the entry point for those soluti...
eager-peachโข2y ago
Hey @dipbazz,
It seems to be related to your cerbos configuration. Maybe @alexolivier can help you ๐
foreign-sapphireโข2y ago
Hey @salihozdemir, may be I am completely new to cerbos. So may have missed something. But from my project the api call is not been triggered for other resources except dashboard. But in the example project the api call for all resources will be triggered.
eager-peachโข2y ago
Is there anything you do differently from the example? Or can you provide a codesandbox environment that we can reproduce the issue to better understand the problem?
Btw, the
accessControlProvider
does not handle the routes. In the example, the API call for all resources might be coming from the Sider component.foreign-sapphireโข2y ago
In my sider I have
CanAccess
wrapper component, but I am not sure why the api call is not executed. I will try to recreate the sandbox and let you know about it.
I am getting this kind of error.
I have tried to recreate the situation by creating a new project. But on my new project I don't get any errors with the API call on cerbos. I am only facing it with my ongoing project. What am I doing wrong? I have also tried to integrated the sider menu same as the new project by updating the refine package to latest version. I only get the errors on my console as show above.quickest-silverโข2y ago
@dipbazz Can you try to change this line?
to
foreign-sapphireโข2y ago
Hey @batuhanw, Nothing happens same issue. But when I use the code you provided on newly created project to test, it works fine without any issue.
Hey @batuhanw and @salihozdemir I have figured out the problem and it is because of the icon on my resources. If I use the icons I get the error as
TypeError: cyclic object value
but if there is not any icon then it works as fine.
To reproduce the same issue I am facing you can install any icons library and use it on the resource icon option then it will throw an error.eager-peachโข2y ago
Quite an interesting bug, we'd love it if you could create an issue for us to investigate it ๐
foreign-sapphireโข2y ago
Here is the issue https://github.com/refinedev/refine/issues/3681
GitHub
[BUG] TypeError: cyclic object value, while using access control ce...
Describe the bug The problem occurred when trying to use cerbos as access control. The problem doesn't occur when used cerbos without icon in resource but occurs when we use custom icon for...
foreign-sapphireโข16mo ago
Hey @salihozdemir @batuhanw , when I use the icons on sidebar menu the icons are displayed but still I get the error message in my console. Am I missing something?
For your reference I have upgraded my refine package to the latest.
quickest-silverโข16mo ago
Hello @dipbazz thanks for the report, we are on it
eager-peachโข16mo ago
Do you have a
React.Node
property other than icon
in the resource definition, in meta
, in options
, etc.?foreign-sapphireโข16mo ago
Hey @salihozdemir , no I don't have any. I have list, show, edit, and create property. In those resource with list, create, show, and edit property I get that error, but not on resources that only have
name
and meta
property.eager-peachโข16mo ago
We do not get an error when we try to reproduce. Can you provide a project in codesandbox or any other way to get the error?
foreign-sapphireโข16mo ago
Hey @salihozdemir , I have tried in the code sandbox and couldn't reproduce the problem, but in my project I still have the issue. I will try to reproduce the issues whenever I get time and let you know.