fix: Export support logs is not working #2531
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Exporting logs is currently failing with this error message:
We are handling circular references in
makeSafeToStringify()
before callingJSON.stringify()
, but it seems that some of them are not being handled properly. This was tricky to debug since it was unclear to me where/how exactly it was failing. I spent some time trying to fix our custom implementation before settling with a library, safe-stable-stringify (MIT license), that would handle circular structures and BigInt in a performant way.There are a few differences between our previous custom implementation vs
safe-stable-stringify
:The blacklist was updated with new entries to reduce the log size and prevent length errors when exporting:
client
object, which was already blacklisted, was also found in a few other paths, which have now been blacklisted as well.Tested by:
Note:
After more testing, I tried using the new blacklist with our original custom implementation, and it appears to also work. I narrowed it down to
draftManager/draftStorage
, which seemed to be causing the circular structure error.However, when using the library, there is no error when serializing this key, albeit producing a 31mb log file, indicating that there is still something wrong with our implementation. We could solve this specific issue by blacklisting this key, but switching to a library might be a better idea to prevent such cases in the future.