feat: add S3 config validation and improve error messages in STT endpoint

This commit is contained in:
Ender 2025-10-24 02:42:04 +02:00
parent 4dffb86ca8
commit 1bade47194
2 changed files with 7 additions and 1 deletions

View File

@ -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 });

BIN
tmp/sample.webm Normal file

Binary file not shown.