-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
Ensure Breadcrumbs and SentryEvents are always serialisable #1582
Ensure Breadcrumbs and SentryEvents are always serialisable #1582
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1582 +/- ##
==========================================
- Coverage 91.19% 90.32% -0.87%
==========================================
Files 61 181 +120
Lines 2078 5861 +3783
==========================================
+ Hits 1895 5294 +3399
- Misses 183 567 +384
☔ View full report in Codecov by Sentry. |
Shouldn't sentry-dart/dart/lib/src/utils.dart Line 31 in d783424
|
You mean using this callback in combination with jsonEncode? That does seem like a more elegant and would automatically work for any new map entries that are not encodable. However, if one of the custom user objects has a toJson function, then it will be encoded. This does not seem desirable, as Sentry does not know how to decode it. I guess it would be possible to copy paste from the web UI and decode it using some dart code. This is also more useful than duplicating the I can also ignore jsonEncode, and manually call the callback on the objects, but then we lose the automatic fallback for new objects. |
Just had a closer look at the logs in my Sentry instance, and actually the events that cause the original issue are there in the web UI even without this fix (using Sentry 6.22.0). It seems like the only change from this PR is that the errors are not logged any more. Is there another path in the code that submits breadcrumbs? The native call here is definitely failing, so the breadcrumb should not be present. |
The Flutter to native sync could be a culprit:
That method is executed when a breadcrumb is added, which then directly sends it via method channel to the native side. As the object is not serializable, it fails. But when the actual error is send, the serialization succeeds because the code path is a different one. This is just a hunch though. |
See #1581 (comment) |
On Java there's a base interface called The SDK though should not set any field (automatically) that isn't serializable by default, so I think:
Those should not be part of the crumb anyway, probably an oversight, not just because of serialization. |
This is going to be addressed by #1591 which is a more generic approach. |
📜 Description
Fixes unserialisable Breadcrumbs and SentryEvents created from log records containing an
object
,stacktrace
orerror
of a type not supported by theStandardMessageCodec
.Fixes #1581
💡 Motivation and Context
Fixes #1581
💚 How did you test it?
Run the dart tests in the repo.
📝 Checklist
sendDefaultPii
is enabled🔮 Next steps
I'm not sure if there is any utility in uploading a second copy of the object this way. It should always be identical to the existing
message
field of the breadcrumb, so it is just a duplicate. The only information it adds that the log call looked likelog.info(MyObject())
, rather thanlog.info('${MyObject}')
which is irrelevant.