Skip to content

feat: add structured logging for creator list timeouts#386

Merged
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
shadrach68:request-timeout
May 31, 2026
Merged

feat: add structured logging for creator list timeouts#386
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
shadrach68:request-timeout

Conversation

@shadrach68
Copy link
Copy Markdown
Contributor

Description

Resolves #374

Previously, when the creator list endpoint timed out, a generic 500 error was surfaced to the client, but it lacked structured server-side context to debug why it timed out. This PR introduces a specific guard in the error middleware to catch timeouts on this endpoint and emit a warn-level log with the necessary context (request ID, elapsed time, and query parameters) to diagnose slow queries.

Changes Made

  • Added isCreatorListTimeout type guard in src/middlewares/error.middleware.ts to identify timeouts on GET /api/v1/creators.
  • Intercepted these specific timeouts to emit a logger.warn with structured fields:
    • requestId
    • elapsedMs
    • queryParams
  • Ensured the code falls through to mapUnknownRouteError so the client still receives the expected 500 error envelope.
  • Added comprehensive unit tests in src/middlewares/error.middleware.test.ts to verify the log output and response stability.

Acceptance Criteria Met

  • A creator list timeout emits a warn-level log with elapsed time and request ID.
  • Active query params are included to help reproduce the slow request.
  • The client timeout response is unchanged.

Testing

  • Ran unit tests via jest successfully.
  • Verified the mock logger.warn receives the exact structured object expected.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

@shadrach68 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093 Chucks1093 merged commit 9b0cde9 into accesslayerorg:main May 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add structured log for request timeout on creator list endpoint

2 participants