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

500 error on hit button "Add resolution notes" by slack integration #5256

Closed
fish0373 opened this issue Nov 15, 2024 · 1 comment
Closed
Labels
bug Something isn't working part:chatops

Comments

@fish0373
Copy link

What went wrong?

What happened:
-Image

How do we reproduce it?

  1. Install Slack Oncall Plugin
  2. Setup Slack notification
  3. Send demo alert
  4. go to slack hit button "Add resolution notes"
  5. show result code 500

Grafana OnCall Version

oncall v1.11.5

Product Area

Chatops

Grafana OnCall Platform?

Docker

User's Browser?

No response

Anything else to add?

2024-11-15 03:06:06 source=engine:app google_trace_id=none logger=apps.slack.views Request id: None

2024-11-15 03:06:06 source=engine:app google_trace_id=none logger=apps.slack.views Organization: <property object at 0x7f5b77cb3a60>: <django.db.models.query_utils.DeferredAttribute object at 0x7f5b7394c3b0>

2024-11-15 03:06:06 source=engine:app google_trace_id=none logger=apps.slack.views SlackUserIdentity detected: g112233445598

2024-11-15 03:06:06 source=engine:app google_trace_id=none logger=apps.slack.views Routing to <class 'apps.slack.scenarios.resolution_note.ResolutionNoteModalStep'>

2024-11-15 03:06:07 source=engine:app google_trace_id=none logger=apps.slack.client Slack API call error! slack_team_identity=1 args=('views.open',) kwargs={'json': {'trigger_id': '8046495381521.7829527176215.dbfa903d3247cb3fad6cd66e275cb87a', 'view': {'blocks': [{'type': 'image', 'title': {'type': 'plain_text', 'text': 'You can add thread messages as resolution notes using the message shortcut'}, 'image_url': 'http://172.24.120.115:8080/static/images/resolution_note.gif', 'alt_text': 'You can add thread messages as resolution notes using the message shortcut'}], 'type': 'modal', 'title': {'type': 'plain_text', 'text': 'Resolution notes'}, 'private_metadata': '{"organization_id": 1, "alert_group_pk": 8360}'}}} status=200 error=invalid_arguments response={'ok': False, 'error': 'invalid_arguments', 'response_metadata': {'messages': ['[ERROR] downloading image failed [json-pointer:view/blocks/0/image_url]']}}

2024-11-15 03:06:07 source=engine:app google_trace_id=none logger=django.request Internal Server Error: /slack/interactive_api_endpoint/

Traceback (most recent call last):

  File "/etc/app/apps/slack/client.py", line 128, in api_call

    response = super().api_call(*args, **kwargs)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/slack_sdk/web/base_client.py", line 156, in api_call

    return self._sync_send(api_url=api_url, req_args=req_args)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/slack_sdk/web/base_client.py", line 187, in _sync_send

    return self._urllib_api_call(

           ^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/slack_sdk/web/base_client.py", line 317, in _urllib_api_call

    ).validate()

      ^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/slack_sdk/web/slack_response.py", line 199, in validate

    raise e.SlackApiError(message=msg, response=self)

slack_sdk.errors.SlackApiError: The request to the Slack API failed. (url: https://www.slack.com/api/views.open)

The server responded with: {'ok': False, 'error': 'invalid_arguments', 'response_metadata': {'messages': ['[ERROR] downloading image failed [json-pointer:view/blocks/0/image_url]']}}

 

The above exception was the direct cause of the following exception:

 

Traceback (most recent call last):

  File "/usr/local/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response

    response = wrapped_callback(request, *callback_args, **callback_kwargs)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view

    return view_func(*args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view

    return self.dispatch(request, *args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/rest_framework/views.py", line 509, in dispatch

    response = self.handle_exception(exc)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/rest_framework/views.py", line 469, in handle_exception

    self.raise_uncaught_exception(exc)

  File "/usr/local/lib/python3.12/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception

    raise exc

  File "/usr/local/lib/python3.12/site-packages/rest_framework/views.py", line 506, in dispatch

    response = handler(request, *args, **kwargs)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/etc/app/apps/slack/views.py", line 405, in post

    step.process_scenario(slack_user_identity, slack_team_identity, payload)

  File "/etc/app/apps/slack/scenarios/resolution_note.py", line 424, in process_scenario

    self._slack_client.views_open(trigger_id=payload["trigger_id"], view=view)

  File "/usr/local/lib/python3.12/site-packages/slack_sdk/web/client.py", line 4606, in views_open

    return self.api_call("views.open", json=kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/etc/app/apps/slack/client.py", line 153, in api_call

    raise error_class(e.response) from e

apps.slack.errors.SlackAPIError: Slack API error! Response: {'ok': False, 'error': 'invalid_arguments', 'response_metadata': {'messages': ['[ERROR] downloading image failed [json-pointer:view/blocks/0/image_url]']}}

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "/usr/local/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner

    response = get_response(request)

               ^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/django/core/handlers/base.py", line 199, in _get_response

    response = self.process_exception_by_middleware(e, request)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/django/core/handlers/base.py", line 362, in process_exception_by_middleware

    response = middleware_method(request, exception)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/etc/app/apps/social_auth/middlewares.py", line 20, in process_exception

    url_builder = UIURLBuilder(request.user.organization)

                               ^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: 'AnonymousUser' object has no attribute 'organization'

2024-11-15 03:06:07 source=engine:app google_trace_id=none logger=root inbound latency=0.820985 status=500 method=POST path=/slack/interactive_api_endpoint/ user_agent=Slackbot 1.0 (+https://api.slack.com/robots) content-length=10443 slow=0

2024-11-15 03:06:07 source=engine:uwsgi status=500 method=POST path=/slack/interactive_api_endpoint/ latency=0.825932 google_trace_id=- protocol=HTTP/1.0 resp_size=385 req_body_size=10443


@fish0373 fish0373 added the bug Something isn't working label Nov 15, 2024
@joeyorlando
Copy link
Contributor

hello 👋

I see you're running v1.11.5, I believe 07d289b (which was included in the v1.12.0) may fix this issue you're seeing. Can you try upgrading and see if you still hit this?

I'm going to close this for now, but if you're still hitting it, we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working part:chatops
Projects
None yet
Development

No branches or pull requests

2 participants