-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(core): Use maxValueLength in extra error data integration #12174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -97,7 +103,7 @@ function _extractErrorData(error: ExtendedError, captureErrorCause: boolean): Re | |||
continue; | |||
} | |||
const value = error[key]; | |||
extraErrorInfo[key] = isError(value) ? value.toString() : value; | |||
extraErrorInfo[key] = truncate(isError(value) ? value.toString() : value, maxValueLength); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually now that I'm looking at this again, const value = error[key]
means that value
could be anything. What is the cleanest way here to make sure we truncate all the string? Should I adjust the normalize
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just do something like this:
extraErrorInfo[key] = truncate(isError(value) ? value.toString() : value, maxValueLength); | |
extraErrorInfo[key] = isError(value) || typeof value === 'string' ? truncate(`${value}`, maxValueLength) : value; |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue here is that it'll only truncate string values at the top-most level. String values that are nested within an object will not get truncated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I see. Yeah then if we want to fix this I guess we have to update normalize to also handle max value length!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the normalize update will mean refactoring how base client and event processing works, I'm electing for the quick fix and just using your change on the extraErrorInfo[key]
setter. This also unblocks the user.
I will create a GH issue and write down what we need to do to make a more robust fix.
Any update on this? We're starting to retroactively discover more and more lost errors that our engineering team needs to be aware of due to this bug. |
Hi @WesCossick sorry for the delay - there were some other items that took my attention away from this recently. I will try to get to this tomorrow and release by next week. The source of the problems are the As another workaround, you can make sure that the fields set by |
1bdace8
to
6cca211
Compare
Am I dumb or could we use our |
fixes #12168
We should truncate extra error data keys using
maxValueLength
to make sure event payload size stays reasonably small.