dify icon indicating copy to clipboard operation
dify copied to clipboard

An error was encountered when enabling the performance tracking feature.

Open filwu8 opened this issue 9 months ago • 2 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.0.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

An error was encountered when enabling the performance tracking feature.

Image

✔️ Expected Behavior

the performance tracking feature si running

❌ Actual Behavior

api-1 | 2025-03-14 23:26:14.168 ERROR [Dummy-18] [app.py:875] - Exception on /console/api/apps/f112ffda-4341-40ce-b7ed-77bb7426803e/trace [POST] api-1 | Traceback (most recent call last): api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request api-1 | rv = self.dispatch_request() api-1 | ^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request api-1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/init.py", line 489, in wrapper api-1 | resp = resource(*args, **kwargs) api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view
api-1 | return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/init.py", line 604, in dispatch_request api-1 | resp = meth(*args, **kwargs) api-1 | ^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/controllers/console/wraps.py", line 187, in decorated api-1 | return view(*args, **kwargs) api-1 | ^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/libs/login.py", line 94, in decorated_view api-1 | return current_app.ensure_sync(func)(*args, **kwargs) api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/controllers/console/wraps.py", line 30, in decorated api-1 | return view(*args, **kwargs) api-1 | ^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/controllers/console/app/app.py", line 319, in post api-1 | if not current_user.is_editing_role: api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | AttributeError: 'Account' object has no attribute 'is_editing_role'

filwu8 avatar Mar 14 '25 15:03 filwu8

The error you're encountering, "AttributeError: 'Account' object has no attribute 'is_editing_role'", is likely due to the absence of the is_editing_role method or attribute in the TenantAccountRole class. The Account class is attempting to use this method to check the user's role, but it seems to be missing.

To resolve this issue, ensure that the TenantAccountRole class includes a method named is_editing_role. Here's a possible implementation you can add to the TenantAccountRole class:

class TenantAccountRole:
    @staticmethod
    def is_editing_role(role):
        # Implement the logic to determine if the role is an editing role
        return role in ['editor', 'admin', 'owner']  # Example roles that might have editing permissions

Make sure to adjust the logic inside is_editing_role to fit the actual roles and permissions in your application [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Mar 14 '25 15:03 dosubot[bot]

I’m encountering the same issue on the latest main branch. It appears #15709 hasn’t resolved it...

RyotaMono avatar Mar 15 '25 07:03 RyotaMono

Hi, @filwu8. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary

  • You reported an AttributeError in the performance tracking feature of Dify version 1.0.1 using a self-hosted Docker setup.
  • The error is due to a missing is_editing_role method in the TenantAccountRole class.
  • I suggested adding the missing method to resolve the error.
  • RyotaMono confirmed the issue persists on the latest main branch, indicating pull request #15709 did not fix it.

Next Steps

  • Please confirm if this issue is still relevant to the latest version of the Dify repository. If so, you can keep the discussion open by commenting here.
  • If there is no further activity, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar Apr 15 '25 16:04 dosubot[bot]