diff --git a/src/infra/src/table/alerts/mod.rs b/src/infra/src/table/alerts/mod.rs index c2d51d6937..46fc8c30d0 100644 --- a/src/infra/src/table/alerts/mod.rs +++ b/src/infra/src/table/alerts/mod.rs @@ -80,8 +80,13 @@ impl TryFrom for MetaAlert { let destinations: Vec = serde_json::from_value(value.destinations)?; let recovery_destinations: Vec = value .recovery_destinations - .map(serde_json::from_value) - .transpose()? + .map(|raw| serde_json::from_str(&raw)) + .transpose() + .map_err(|e| { + errors::Error::Message(format!( + "alert {id} has an invalid recovery_destinations value: {e}" + )) + })? .unwrap_or_default(); let context_attributes: Option> = value .context_attributes @@ -961,7 +966,7 @@ fn update_mutable_fields( let recovery_destinations = if alert.recovery_destinations.is_empty() { None } else { - Some(serde_json::to_value(alert.recovery_destinations)?) + Some(serde_json::to_string(&alert.recovery_destinations)?) }; let keep_firing_for_seconds = alert.keep_firing_for; diff --git a/src/infra/src/table/entity/alerts.rs b/src/infra/src/table/entity/alerts.rs index d36794e005..1f8b20a08b 100644 --- a/src/infra/src/table/entity/alerts.rs +++ b/src/infra/src/table/entity/alerts.rs @@ -87,7 +87,7 @@ pub struct Model { /// the alert predates the feature, which is the same as `false`. pub notify_on_recovery: Option, /// JSON array of destination names. NULL = the recovery follows the firing's own destinations. - pub recovery_destinations: Option, + pub recovery_destinations: Option, /// How long the condition must stay clear before the episode recovers. /// NULL or 0 recovers on the first clear evaluation. pub keep_firing_for_seconds: Option,