Skip to content

Log only safe fields of axios errors - #562

Draft
Ferrum-Citadel wants to merge 1 commit into
masterfrom
fix/log-axios-errors-safely
Draft

Ferrum-Citadel wants to merge 1 commit into
masterfrom
fix/log-axios-errors-safely

Conversation

@Ferrum-Citadel

@Ferrum-Citadel Ferrum-Citadel commented Nov 12, 2026 •

Copy link
Copy Markdown

Problem

An axios error holds the request config and the raw request. When an app logs one, orka writes the whole error to the JSON logs and to the Honeybadger context. This includes the Authorization header, auth, the request body and the query string.

Fix

For axios errors, both appenders log only these fields:

  • name, message, code, status.
  • config.method, config.baseURL, config.url, without the query string.
  • response.status, response.statusText, response.data, if it is not a stream or a buffer.

Both appenders do this at any depth in the context.

Impact

Apps that log axios errors with LOG_JSON=true or Honeybadger. The kept fields keep their paths. Other fields, for example response.headers, are not logged now. Other logs do not change.

Tests

  • New tests make a failed axios call with nock and check that no secret gets into the log. They fail on master.
  • TEST_KAFKA=true npm test: 317 passing, 10 pending.

The pre-commit hook reformatted two old blocks in json-appender.test.ts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KFGeS5cho3JHRATAcd4847

@Ferrum-Citadel
Ferrum-Citadel force-pushed the fix/log-axios-errors-safely branch from f306424 to f0fd55e Compare November 12, 2026 09:30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KFGeS5cho3JHRATAcd4847
@Ferrum-Citadel
Ferrum-Citadel force-pushed the fix/log-axios-errors-safely branch from f0fd55e to 011988d Compare November 12, 2026 09:36

This branch has not been deployed

No deployments
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.

1 participant