feat: add S3 config validation and improve error messages in STT endpoint
This commit is contained in:
parent
4dffb86ca8
commit
1bade47194
@ -12,7 +12,13 @@ router.post('/', async (req, res) => {
|
|||||||
return res.status(400).json({ error: 'bucket (or env S3_BUCKET) and key are required' });
|
return res.status(400).json({ error: 'bucket (or env S3_BUCKET) and key are required' });
|
||||||
}
|
}
|
||||||
if (!process.env.OPENAI_API_KEY) {
|
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 });
|
const { buffer, contentType } = await downloadObject({ bucket, key });
|
||||||
|
|||||||
BIN
tmp/sample.webm
Normal file
BIN
tmp/sample.webm
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user