Skip to content

Event timestamp serialization from JSON #3108

Closed

Description

@arend-melissant-tnt

Package

Sentry

.NET Flavor

.NET

.NET Version

8.0

OS

Any (not platform specific)

SDK Version

4.0.0

Self-Hosted Sentry Version

No response

Steps to Reproduce

read envelope from incoming message (using sentry-cli send-event)
deserialize envelope using var envelope = await Envelope.DeserializeAsync(stream);

this will throw an exception: The requested operation requires an element of type 'String', but the target element has type 'Number'.

this is an the "timestamp" element of the event payload

Expected Result

timestamp should deserialize with either a string or number (per SDK)

Actual Result

Exception thrown

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Feb 2, 2024
  2. bruno-garcia commented on Feb 2, 2024

    @bruno-garcia
    Member
    read envelope from incoming message (using sentry-cli send-event)
    deserialize envelope using var envelope = await Envelope.DeserializeAsync(stream);
    

    There might be something to fix here but to to clarify: An envelope and an event are different things. Envelopes contain items, and one of those could be an event.

    What are you trying to accomplish? we might be able to help you differently

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Feb 2, 2024
  4. arend-melissant-tnt commented on Feb 3, 2024

    @arend-melissant-tnt
    Author

    Hi,

    I'm just trying to deserialize an complete received envelope, which fails if it contains an event with a timestamp formatted as a number. When te timestamp is formatted as a string everything works as expected. I do see in the code (or so it seems) that timestamps as numbers are not supported, but that should be supported as even the sentry-cli sends such events.

  5. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Feb 3, 2024
  6. bitsandfoxes commented on Feb 5, 2024

    @bitsandfoxes
    Contributor

    Happy to help but I'm not quite following how to reproduce the issue you're running into:
    You're sending an event via sentry-cli but how and why does that generated envelope end up in the .NET SDK? The stream is just the deserialized envelope you're picking up from somewhere?

  7. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Feb 5, 2024
  8. arend-melissant-tnt commented on Feb 5, 2024

    @arend-melissant-tnt
    Author

    I'm forwarding messages to Sentry, that's how I get the messages. I'll create a small test for you to see what's happening

  9. 14 remaining items

  10. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Feb 28, 2025
  11. aritchie commented on Feb 28, 2025

    @aritchie
    Contributor

    @Tuytje #3958 <= this PR contains other features, but also a fix for this particular issue

  12. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Feb 28, 2025
  13. aritchie commented on Feb 28, 2025

    @aritchie
    Contributor

    Referencing #2102 - close this issue with that issue

  14. albyrock87 commented on Mar 1, 2025

    @albyrock87
    Contributor

    @aritchie if it helps this is the involved JSON

    {
      "timestamp": "2025-03-01T11:01:48.534Z",
      "type": "system",
      "data": {
        "upload_bandwidth": 150560,
        "action": "NETWORK_CAPABILITIES_CHANGED",
        "vpn_active": false,
        "signal_strength": -60,
        "network_type": "wifi",
        "download_bandwidth": 25236
      },
      "category": "network.event",
      "level": "info"
    }
    
  15. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Mar 1, 2025
  16. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Mar 1, 2025
  17. ghost added on Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First IssueTask

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions