Skip to content

Commit 847e00b

Browse files
waleedlatif1claude
andcommitted
fix(rootly): handle 204 No Content response for delete_incident
DELETE /v1/incidents/{id} returns 204 with empty body. Avoid calling response.json() on success — return success/message instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3f9fe36 commit 847e00b

File tree

2 files changed

+11
-48
lines changed

2 files changed

+11
-48
lines changed

apps/sim/tools/rootly/delete_incident.ts

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -39,64 +39,26 @@ export const rootlyDeleteIncidentTool: ToolConfig<
3939
const errorData = await response.json().catch(() => ({}))
4040
return {
4141
success: false,
42-
output: { incident: {} as RootlyDeleteIncidentResponse['output']['incident'] },
42+
output: {
43+
success: false,
44+
message:
45+
errorData.errors?.[0]?.detail || `HTTP ${response.status}: ${response.statusText}`,
46+
},
4347
error: errorData.errors?.[0]?.detail || `HTTP ${response.status}: ${response.statusText}`,
4448
}
4549
}
4650

47-
const data = await response.json()
48-
const attrs = data.data?.attributes || {}
4951
return {
5052
success: true,
5153
output: {
52-
incident: {
53-
id: data.data?.id ?? null,
54-
sequentialId: attrs.sequential_id ?? null,
55-
title: attrs.title ?? '',
56-
slug: attrs.slug ?? null,
57-
kind: attrs.kind ?? null,
58-
summary: attrs.summary ?? null,
59-
status: attrs.status ?? null,
60-
private: attrs.private ?? false,
61-
url: attrs.url ?? null,
62-
shortUrl: attrs.short_url ?? null,
63-
severityName: attrs.severity?.data?.attributes?.name ?? null,
64-
severityId: attrs.severity?.data?.id ?? null,
65-
createdAt: attrs.created_at ?? '',
66-
updatedAt: attrs.updated_at ?? '',
67-
startedAt: attrs.started_at ?? null,
68-
mitigatedAt: attrs.mitigated_at ?? null,
69-
resolvedAt: attrs.resolved_at ?? null,
70-
closedAt: attrs.closed_at ?? null,
71-
},
54+
success: true,
55+
message: 'Incident deleted successfully',
7256
},
7357
}
7458
},
7559

7660
outputs: {
77-
incident: {
78-
type: 'object',
79-
description: 'The deleted incident details',
80-
properties: {
81-
id: { type: 'string', description: 'Unique incident ID' },
82-
sequentialId: { type: 'number', description: 'Sequential incident number' },
83-
title: { type: 'string', description: 'Incident title' },
84-
slug: { type: 'string', description: 'Incident slug' },
85-
kind: { type: 'string', description: 'Incident kind' },
86-
summary: { type: 'string', description: 'Incident summary' },
87-
status: { type: 'string', description: 'Incident status' },
88-
private: { type: 'boolean', description: 'Whether the incident is private' },
89-
url: { type: 'string', description: 'URL to the incident' },
90-
shortUrl: { type: 'string', description: 'Short URL to the incident' },
91-
severityName: { type: 'string', description: 'Severity name' },
92-
severityId: { type: 'string', description: 'Severity ID' },
93-
createdAt: { type: 'string', description: 'Creation date' },
94-
updatedAt: { type: 'string', description: 'Last update date' },
95-
startedAt: { type: 'string', description: 'Start date' },
96-
mitigatedAt: { type: 'string', description: 'Mitigation date' },
97-
resolvedAt: { type: 'string', description: 'Resolution date' },
98-
closedAt: { type: 'string', description: 'Closed date' },
99-
},
100-
},
61+
success: { type: 'boolean', description: 'Whether the deletion succeeded' },
62+
message: { type: 'string', description: 'Result message' },
10163
},
10264
}

apps/sim/tools/rootly/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ export interface RootlyDeleteIncidentParams extends RootlyBaseParams {
379379

380380
export interface RootlyDeleteIncidentResponse extends ToolResponse {
381381
output: {
382-
incident: RootlyIncidentData
382+
success: boolean
383+
message: string
383384
}
384385
}
385386

0 commit comments

Comments
 (0)