Skip to content

Commit 037424f

Browse files
committed
fix(API): log staging commit errors via winston instead of stderr
The commit endpoint's catch block used console.trace, which writes to stderr and never reaches the structured winston log files. This made 400 responses from POST /v1/staging/commit opaque in logs, forcing operators to correlate with pm2/journald output to find the root cause. Route the error through the existing logger so the reason lands in combined.log and error.log alongside the request metadata.
1 parent e2ac103 commit 037424f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/controllers/staging.controller.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import _ from 'lodash';
33
import { Sequelize } from 'sequelize';
44
import { Staging } from '../models';
55

6+
import { logger } from '../config/logger.js';
7+
68
import {
79
optionallyPaginatedResponse,
810
paginationParams,
@@ -110,7 +112,9 @@ export const commit = async (req, res) => {
110112
success: true,
111113
});
112114
} catch (error) {
113-
console.trace(error);
115+
logger.error(`POST /v1/staging/commit failed: ${error.message}`, {
116+
stack: error.stack,
117+
});
114118
res.status(400).json({
115119
message: 'Error commiting staging table',
116120
error: error.message,

0 commit comments

Comments
 (0)