Skip to content

Commit 8d6d341

Browse files
committed
fix(pagerduty): reject resolution note unless status is resolved
PagerDuty only accepts an incident's resolution field when status is being set to resolved in the same request; sending it otherwise gets rejected by the API with an opaque error.
1 parent c3a080c commit 8d6d341

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

apps/sim/tools/pagerduty/update_incident.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ export const updateIncidentTool: ToolConfig<
8686
if (params.escalationLevel) {
8787
incident.escalation_level = Number(params.escalationLevel)
8888
}
89-
if (params.resolution) incident.resolution = params.resolution
89+
if (params.resolution) {
90+
if (params.status !== 'resolved') {
91+
throw new Error('resolution can only be set when status is resolved')
92+
}
93+
incident.resolution = params.resolution
94+
}
9095
return { incident }
9196
},
9297
},

0 commit comments

Comments
 (0)