grafana / incident-community

Public repository for Grafana Incident feedback, bug reports, discussions, and updates.
26 stars 2 forks source link

Cannot delete Incident when Slack channel has already been archived. #12

Open codecrane opened 2 years ago

codecrane commented 2 years ago

Describe the bug With Slack integration enabled, deleting an incident for which the Slack Channel has already been archived via Slack, causes an error. This prevents the deletion of the incident.

To Reproduce Steps to reproduce the behavior:

  http -A bearer -a $TOKEN \
  POST https://cfacorp.grafana.net/api/plugins/grafana-incident-app/resources/api/IncidentsService.DeleteIncident \
  incidentID="1"

Expected behavior I expect the deletion of the incident to occur, gracefully stepping past the archiving of an already archived channel.

Screenshots

HTTP/1.1 500 Internal Server Error
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Cache-Control: no-cache
Content-Encoding: gzip
Content-Length: 124
Content-Security-Policy: sandbox
Content-Type: application/json; charset=utf-8
Date: Tue, 19 Jul 2022 18:06:03 GMT
Expires: -1
Pragma: no-cache
Server: envoy
Strict-Transport-Security: max-age=86400, max-age=86400
Vary: Origin
Via: 1.1 google
X-Content-Type-Options: nosniff
X-Envoy-Upstream-Service-Time: 172
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block

{
    "error": "incidentsService.DeleteIncident: DeleteRoom: SlackProvider: SlackClient.ArchiveConversationContext: not_in_channel"
}

Relevant system information Grafana Incidents version: v1.0.0-beta28

matryer commented 2 years ago

thanks @codecrane, great report - we'll take a look. cc @aron-bordin

brngates98 commented 1 year ago

could try this

Delete Specific Range of Incidents

If you want to delete a specific range of incidents, you can use the following Bash script. Replace your_token with your actual token and adjust the URL according to your Grafana incident app setup. This script will delete incidents with IDs from 1 to 10.


TOKEN="your_token"
for INCIDENT_ID in $(seq 1 10); do
  curl -X POST \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d "{\"incidentID\": \"$INCIDENT_ID\"}" \
    "https://org.grafana.net/api/plugins/grafana-incident-app/resources/api/IncidentsService.DeleteIncident"
done