Skip to content
Prev Previous commit
Next Next commit
fix(cloudwatch): fix DescribeAlarms returning only MetricAlarm when "…
…All Types" selected

Per AWS docs, omitting AlarmTypes returns only MetricAlarm. Now explicitly
sends both MetricAlarm and CompositeAlarm when no filter is selected.

Also fix dimensions JSON parse errors returning 500 instead of 400 in
get-metric-statistics route.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
  • Loading branch information
waleedlatif1 and claude committed Apr 8, 2026
commit 0aecc0f6953e1f05f71c2dc66147bb03b51825e5
4 changes: 3 additions & 1 deletion apps/sim/app/api/tools/cloudwatch/describe-alarms/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export async function POST(request: NextRequest) {
const command = new DescribeAlarmsCommand({
...(validatedData.alarmNamePrefix && { AlarmNamePrefix: validatedData.alarmNamePrefix }),
...(validatedData.stateValue && { StateValue: validatedData.stateValue as StateValue }),
...(validatedData.alarmType && { AlarmTypes: [validatedData.alarmType as AlarmType] }),
AlarmTypes: validatedData.alarmType
? [validatedData.alarmType as AlarmType]
: (['MetricAlarm', 'CompositeAlarm'] as AlarmType[]),
...(validatedData.limit !== undefined && { MaxRecords: validatedData.limit }),
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function POST(request: NextRequest) {
}))
}
} catch {
throw new Error('Invalid dimensions JSON')
return NextResponse.json({ error: 'Invalid dimensions JSON format' }, { status: 400 })
}
}

Expand Down
Loading