From 1bade4719413bcfa4c88fa7cedf331632c8d60af Mon Sep 17 00:00:00 2001 From: Ender Date: Fri, 24 Oct 2025 02:42:04 +0200 Subject: [PATCH] feat: add S3 config validation and improve error messages in STT endpoint --- apps/api/src/stt.ts | 8 +++++++- tmp/sample.webm | Bin 0 -> 10 bytes 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tmp/sample.webm diff --git a/apps/api/src/stt.ts b/apps/api/src/stt.ts index fa20819..5a38365 100644 --- a/apps/api/src/stt.ts +++ b/apps/api/src/stt.ts @@ -12,7 +12,13 @@ router.post('/', async (req, res) => { return res.status(400).json({ error: 'bucket (or env S3_BUCKET) and key are required' }); } if (!process.env.OPENAI_API_KEY) { - return res.status(500).json({ error: 'OPENAI_API_KEY not configured' }); + console.error('STT failed: missing OPENAI_API_KEY'); + return res.status(500).json({ error: 'Transcription not configured' }); + } + const { S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY } = process.env; + if (!S3_ENDPOINT || !S3_ACCESS_KEY || !S3_SECRET_KEY) { + console.error('STT failed: missing S3 config (S3_ENDPOINT/S3_ACCESS_KEY/S3_SECRET_KEY)'); + return res.status(500).json({ error: 'Object storage not configured' }); } const { buffer, contentType } = await downloadObject({ bucket, key }); diff --git a/tmp/sample.webm b/tmp/sample.webm new file mode 100644 index 0000000000000000000000000000000000000000..cb43b5ce1342e5d73830ac8b6a37ea870fae2632 GIT binary patch literal 10 KcmZQzfB^si3IG8B literal 0 HcmV?d00001