From f59b11f836d6879de78609892f122c2abcfe704c Mon Sep 17 00:00:00 2001 From: ordinarthur <@arthurbarre.js@gmail.com> Date: Fri, 8 May 2026 13:50:10 +0200 Subject: [PATCH] chore(debug): endpoint /api/v1/_debug/sentry-test pour valider Sentry E2E MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Endpoint qui throw délibérément pour tester : - Capture côté Sentry (handler.ts:report) - Release tag (APP_VERSION = sha git) - Sourcemaps désobfusquées - Tags { url=pattern, method, status } - User context (si auth présente) Gardé par NODE_ENV !== 'production' OU DEBUG_SENTRY_TEST=true. Sur prod, activer le temps du test via : kubectl -n rubis set env deploy/rubis-api DEBUG_SENTRY_TEST=true curl -i https://app.rubis.pro/api/v1/_debug/sentry-test # → 500, vérifier Sentry kubectl -n rubis set env deploy/rubis-api DEBUG_SENTRY_TEST- À retirer (revert ce commit) une fois l'intégration Sentry validée. Co-Authored-By: Claude Opus 4.7 --- apps/api/start/routes.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/api/start/routes.ts b/apps/api/start/routes.ts index b35c9a5..4fba853 100644 --- a/apps/api/start/routes.ts +++ b/apps/api/start/routes.ts @@ -22,6 +22,19 @@ router * le init-container migrate. */ router.get('health', () => ({ status: 'ok', uptime: process.uptime() })).as('health') + + /** + * Sentry test trigger — endpoint debug qui throw délibérément pour + * vérifier l'E2E observability (capture, release tag, sourcemaps, + * user context). Disponible UNIQUEMENT si NODE_ENV !== 'production' + * OU si DEBUG_SENTRY_TEST=true. À retirer une fois l'intégration + * validée sur la prod. + */ + if (process.env.NODE_ENV !== 'production' || process.env.DEBUG_SENTRY_TEST === 'true') { + router.get('_debug/sentry-test', () => { + throw new Error(`Sentry test from rubis-api — ${new Date().toISOString()}`) + }) + } }) .prefix('/api/v1')