Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(sentry/alerts): propagate detector lookup failures

justin2012b6d7b14c
diff --git a/scripts/provision-sentry-alerts.sh b/scripts/provision-sentry-alerts.sh
index 9d0f618a0..62915ae69 100755
--- a/scripts/provision-sentry-alerts.sh
+++ b/scripts/provision-sentry-alerts.sh
@@ -328,7 +328,15 @@ for i in $(seq 0 $((COUNT - 1))); do
EXISTING_DET_ID=$(echo "$EXISTING" | jq -r '.detectorIds[0] // empty')
fi
if [ -z "$EXISTING_DET_ID" ]; then
- EXISTING_DET_ID=$(find_detector_by_name "$DETECTOR_NAME" || true)
+ # On a request failure, skip the alert rather than silently letting
+ # an empty ID fall through to create_or_update_detector's POST
+ # path. A successful lookup that finds no match still leaves
+ # EXISTING_DET_ID empty; that's the normal "create new" path.
+ if ! EXISTING_DET_ID=$(find_detector_by_name "$DETECTOR_NAME"); then
+ err " failed to look up existing detector '$DETECTOR_NAME' \u2014 skipping"
+ ERRORS=$((ERRORS + 1))
+ continue
+ fi
fi
if NEW_DET_ID=$(create_or_update_detector "$DETECTOR" "$EXISTING_DET_ID") && [ -n "$NEW_DET_ID" ]; then