Skip to content

fix: fastify synthetic shutdown reply in logger#1028

Merged
ferhatelmas merged 1 commit intomasterfrom
ferhat/shutdown-reply
Apr 16, 2026
Merged

fix: fastify synthetic shutdown reply in logger#1028
ferhatelmas merged 1 commit intomasterfrom
ferhat/shutdown-reply

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

fix

What is the current behavior?

Fastify gives a syntatic reply while shutting down which doesn't have getHeaders on it.

What is the new behavior?

Guard it.

Additional context

It's visible under watt.

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
@ferhatelmas ferhatelmas requested a review from a team as a code owner April 16, 2026 12:28
Copilot AI review requested due to automatic review settings April 16, 2026 12:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a shutdown-time logging crash by making the Fastify response serializer tolerant of Fastify “synthetic” replies that don’t implement getHeaders, preventing logger serialization from throwing during server shutdown (as observed under watt).

Changes:

  • Guard reply.getHeaders() in the res serializer and fall back to an empty header object when unavailable.
  • Add a Vitest unit test to ensure the res serializer does not throw when getHeaders is missing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/internal/monitoring/logger.ts Adds a safe getHeaders guard before header allowlisting in the response serializer.
src/internal/monitoring/logger.test.ts Adds coverage to validate serializer behavior with synthetic replies lacking getHeaders.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ferhatelmas ferhatelmas changed the title fix: fastify syntatic shutdown reply in logger fix: fastify synthetic shutdown reply in logger Apr 16, 2026
@ferhatelmas ferhatelmas merged commit fef8da0 into master Apr 16, 2026
11 checks passed
@ferhatelmas ferhatelmas deleted the ferhat/shutdown-reply branch April 16, 2026 12:37
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 24510222416

Coverage decreased (-0.003%) to 82.565%

Details

  • Coverage decreased (-0.003%) from the base build.
  • Patch coverage: 4 of 4 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 32670
Covered Lines: 29393
Line Coverage: 89.97%
Relevant Branches: 7450
Covered Branches: 3732
Branch Coverage: 50.09%
Branches in Coverage %: Yes
Coverage Strength: 355.84 hits per line

💛 - Coveralls

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.

4 participants