From 71082bca692178140d5ca0d47c54fa5c71bb0d14 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Mon, 25 May 2026 16:33:56 +0100 Subject: [PATCH] Tag migrations-worker Sentry events with source projectId and endpoint When a publishable exception bubbles to Sentry from the migrations worker, include the source projectId and endpoint in the event extras so on-call can correlate the event with the failing migration without a round-trip to the database. Only emitted for Appwrite-source migrations because the credentials shape varies by source type; the apiKey is never included. --- src/Appwrite/Platform/Workers/Migrations.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 2dd59c7b4c..501bfcce8e 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -577,11 +577,21 @@ class Migrations extends Action } if ($publish) { - call_user_func($this->logError, $th, 'appwrite-worker', 'appwrite-queue-' . self::getName(), [ + $extras = [ 'migrationId' => $migration->getId(), 'source' => $migration->getAttribute('source') ?? '', 'destination' => $migration->getAttribute('destination') ?? '', - ]); + ]; + + // Include source identifiers for Appwrite sources to make Sentry events + // self-debuggable. Never include the apiKey or any other secret. + if ($migration->getAttribute('source') === SourceAppwrite::getName()) { + $credentials = $migration->getAttribute('credentials', []) ?? []; + $extras['sourceProjectId'] = $credentials['projectId'] ?? ''; + $extras['sourceEndpoint'] = $credentials['endpoint'] ?? ''; + } + + call_user_func($this->logError, $th, 'appwrite-worker', 'appwrite-queue-' . self::getName(), $extras); } } finally { try {