Skip to content

LG-14128 Stop that the TMx response body is empty on errored transactions#11145

Merged
jmhooper merged 2 commits intomainfrom
jmhooper-dont-log-tmx-empty-response-body-error
Aug 27, 2024
Merged

LG-14128 Stop that the TMx response body is empty on errored transactions#11145
jmhooper merged 2 commits intomainfrom
jmhooper-dont-log-tmx-empty-response-body-error

Conversation

@jmhooper
Copy link
Contributor

We use ThreatMetrix as part of our proofing process. When we get a response from ThreatMetrix we log the response body along with some other metadata about the response. The response body contains sensitive PII that cannot be logged so before logging the response body is passed through the ResponseRedacter which redacts sensitive info.

The ResponseRedacter gaurds against nil response bodies by returning returning a response with an error with the description `TMx response body was empty'. As a result, any time there is no response body to be logged we see that error in our logs. This can be confusing when other errors occur, for example network timeouts or connection failures. It makes it appear as though the issue is a missing response body.

This commit modifies the DdpResult to only redact the response body when it is present. When it is absent a nil value is returned. This will cause the empty response body to quit being logged and appearing in cloudwatch when exceptions occur.

…ions

We use ThreatMetrix as part of our proofing process. When we get a response from ThreatMetrix we log the response body along with some other metadata about the response. The response body contains sensitive PII that cannot be logged so before logging the response body is passed through the `ResponseRedacter` which redacts sensitive info.

The `ResponseRedacter` gaurds against nil response bodies by returning returning a response with an error with the description `TMx response body was empty'. As a result, any time there is no response body to be logged we see that error in our logs. This can be confusing when other errors occur, for example network timeouts or connection failures. It makes it appear as though the issue is a missing response body.

This commit modifies the `DdpResult` to only redact the response body when it is present. When it is absent a nil value is returned. This will cause the empty response body to quit being logged and appearing in cloudwatch when exceptions occur.

[skip changelog]
@jmhooper jmhooper requested review from matthinz and n1zyy August 26, 2024 15:25
@monfresh
Copy link
Contributor

Do we want to add a test when the response is present but empty?

@jmhooper jmhooper merged commit 4961162 into main Aug 27, 2024
@jmhooper jmhooper deleted the jmhooper-dont-log-tmx-empty-response-body-error branch August 27, 2024 16:07
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.

5 participants