Skip to content

Commit 2a852c6

Browse files
Misc fixes to error logging (#834)
Remove next-logger and register console loggers directly in registerLoggers function Fix messageKey for log messages Fix errorKey to serialize errors correctly Rename all "cause" fields to "error" so that we can serialize backend errors correctly Add logs to listAllDomains for errors Add request URL to RequestError (and update tests)
1 parent 62bf40c commit 2a852c6

File tree

46 files changed

+232
-123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+232
-123
lines changed

next-logger.config.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

package-lock.json

Lines changed: 0 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "4.0.0",
44
"private": true,
55
"scripts": {
6-
"dev": "next dev -p ${CADENCE_WEB_PORT} | pino-pretty",
6+
"dev": "next dev -p ${CADENCE_WEB_PORT} | pino-pretty --messageKey message",
77
"build": "NODE_ENV=production && next build",
88
"start": "next start -p ${CADENCE_WEB_PORT}",
99
"lint": "next lint",
@@ -34,7 +34,6 @@
3434
"lodash": "^4.17.21",
3535
"lossless-json": "^4.0.2",
3636
"next": "14.2.16",
37-
"next-logger": "^5.0.0",
3837
"pino": "^9.3.2",
3938
"query-string": "^9.0.0",
4039
"react": "^18.2.0",

src/instrumentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function register() {
1313
// by "Cannot set property message of [object Object] which has only a getter"
1414
logger.error({
1515
message: 'Failed to load configs',
16-
cause: String(e),
16+
error: e,
1717
});
1818
process.exit(1); // use process.exit to exit without an extra error log from instrumentation
1919
}

src/route-handlers/cancel-workflow/cancel-workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function cancelWorkflow(
4545
return NextResponse.json({} satisfies CancelWorkflowResponse);
4646
} catch (e) {
4747
logger.error<RouteHandlerErrorPayload>(
48-
{ requestParams: decodedParams, cause: e },
48+
{ requestParams: decodedParams, error: e },
4949
'Error cancelling workflow'
5050
);
5151

src/route-handlers/describe-cluster/describe-cluster.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export async function describeCluster(
4747
return NextResponse.json(sanitizedRes);
4848
} catch (e) {
4949
logger.error<RouteHandlerErrorPayload>(
50-
{ requestParams: decodedParams, cause: e },
50+
{ requestParams: decodedParams, error: e },
5151
'Error fetching cluster info'
5252
);
5353

src/route-handlers/describe-domain/describe-domain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function describeDomain(
2525
return NextResponse.json(res.domain);
2626
} catch (e) {
2727
logger.error<RouteHandlerErrorPayload>(
28-
{ requestParams: decodedParams, cause: e },
28+
{ requestParams: decodedParams, error: e },
2929
'Error fetching domain info'
3030
);
3131

src/route-handlers/describe-task-list/describe-task-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export async function describeTaskList(
4646
return NextResponse.json({ taskList });
4747
} catch (e) {
4848
logger.error<RouteHandlerErrorPayload>(
49-
{ requestParams: decodedParams, cause: e },
49+
{ requestParams: decodedParams, error: e },
5050
'Error fetching task list'
5151
);
5252

src/route-handlers/describe-workflow/describe-workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export default async function describeWorkflow(
140140
);
141141
} else {
142142
logger.error<RouteHandlerErrorPayload>(
143-
{ requestParams: decodedParams, cause: e },
143+
{ requestParams: decodedParams, error: e },
144144
'Error fetching workflow execution info'
145145
);
146146

src/route-handlers/fetch-workflow-query-types/fetch-workflow-query-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default async function fetchWorkflowQueryTypes(
4444
}
4545

4646
logger.error<RouteHandlerErrorPayload>(
47-
{ requestParams: decodedParams, cause: e },
47+
{ requestParams: decodedParams, error: e },
4848
'Error querying workflow for query types'
4949
);
5050

0 commit comments

Comments
 (0)