From 9c9f2134e76617da7f3506bb4c54ab2d147cebdf Mon Sep 17 00:00:00 2001 From: Stephan Meijer Date: Wed, 8 Jul 2026 15:51:27 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A(y-provider)=20capture=20convert=20?= =?UTF-8?q?handler=20errors=20in=20Sentry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The y-provider `/api/convert` handler catches every writer/reader exception and returns a generic `{"error":"An error occurred"}` 500. The real JS exception is silently dropped: `logger()` only prints to stdout when `COLLABORATION_LOGGING=true`, and Sentry's `setupExpressErrorHandler` only sees unhandled errors — never this one. Result: Sentry issues `DOCS-4ZY` / `DOCS-4ZZ` / `DOCS-6DK` all fire on every 500, but none of them carry the underlying JS stack, making root-cause diagnosis impossible from Python alone. This patch adds `Sentry.captureException` in the outer catch with `handler:convert` tag and `contentType` / `accept` / `bodyBytes` extras. Behavior otherwise unchanged. Signed-off-by: Stephan Meijer --- .../servers/y-provider/src/handlers/convertHandler.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/frontend/servers/y-provider/src/handlers/convertHandler.ts b/src/frontend/servers/y-provider/src/handlers/convertHandler.ts index 570ab176b..69d39836a 100644 --- a/src/frontend/servers/y-provider/src/handlers/convertHandler.ts +++ b/src/frontend/servers/y-provider/src/handlers/convertHandler.ts @@ -5,6 +5,7 @@ import { YjsThreadStore, } from '@blocknote/core/comments'; import { ServerBlockNoteEditor } from '@blocknote/server-util'; +import * as Sentry from '@sentry/node'; import { Request, Response } from 'express'; import * as Y from 'yjs'; @@ -191,6 +192,14 @@ export const convertHandler = async ( .setHeader('content-type', accept) .send(await writer.write(blocks ?? [])); } catch (e) { + Sentry.captureException(e, { + tags: { handler: 'convert' }, + extra: { + contentType, + accept, + bodyBytes: req.body?.length ?? 0, + }, + }); logger('conversion failed:', e); res.status(500).json({ error: 'An error occurred' }); }