Skip to content

fix(#11051): log getUserSettings errors instead of silently swallowing them#11065

Open
shivv23 wants to merge 1 commit into
medic:masterfrom
shivv23:pr-11051-auth-error-logging
Open

fix(#11051): log getUserSettings errors instead of silently swallowing them#11065
shivv23 wants to merge 1 commit into
medic:masterfrom
shivv23:pr-11051-auth-error-logging

Conversation

@shivv23
Copy link
Copy Markdown

@shivv23 shivv23 commented May 14, 2026

Summary

The getUserSettings helper in the authorization middleware silently swallows errors by catching them and returning the error object without any logging. This makes failures invisible in production, leaving operators unable to diagnose issues such as CouchDB connectivity problems or malformed user-settings documents.

Changes

  • Added logger.error() call in the .catch handler of getUserSettings, following the same pattern used by captureReplicationFailures in the same file.
  • Updated unit tests to verify that errors are logged with the correct message and error object.

Testing

  • All existing authorization middleware tests pass (31 tests).
  • Tests verify both getUserCtx failure and getUserSettings failure scenarios produce log output.

…lowing them

The internal getUserSettings helper in authorization.js catches
errors with .catch(err => err), silently dropping the error with
no log line. This makes getUserSettings failures invisible in
production, leaving operators unable to diagnose issues like
CouchDB connectivity problems or malformed user-settings docs.

Added logger.error() call in the .catch handler, following the
same pattern used by captureReplicationFailures in the same file.
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