From a9cc8caf42737c361aa9891dd84cee894b8db538 Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Sat, 16 May 2026 00:31:10 -0400 Subject: [PATCH] fix(recorders): add S3_REGION to container env, accept 304/404 on stop/remove --- services/mam-api/src/routes/recorders.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/mam-api/src/routes/recorders.js b/services/mam-api/src/routes/recorders.js index be7f384..be03e41 100644 --- a/services/mam-api/src/routes/recorders.js +++ b/services/mam-api/src/routes/recorders.js @@ -180,6 +180,7 @@ router.post('/:id/start', async (req, res, next) => { `S3_BUCKET=${s3Bucket}`, `S3_ACCESS_KEY=${s3AccessKey}`, `S3_SECRET_KEY=${s3SecretKey}`, + `S3_REGION=${process.env.S3_REGION || 'us-east-1'}`, `MAM_API_URL=${mamApiUrl}`, `RECORDER_ID=${id}`, `SOURCE_TYPE=${recorder.source_type}`, @@ -263,20 +264,21 @@ router.post('/:id/stop', async (req, res, next) => { `/containers/${recorder.container_id}/stop` ); - if (stopRes.status !== 204) { + // 204 = stopped, 304 = already stopped — both are acceptable + if (stopRes.status !== 204 && stopRes.status !== 304) { return res.status(500).json({ error: 'Failed to stop container', details: stopRes.data, }); } - // Remove container + // Remove container — 204 = removed, 404 = already gone (both acceptable) const removeRes = await dockerApi( 'DELETE', `/containers/${recorder.container_id}` ); - if (removeRes.status !== 204) { + if (removeRes.status !== 204 && removeRes.status !== 404) { return res.status(500).json({ error: 'Failed to remove container', details: removeRes.data,