sentry-rust icon indicating copy to clipboard operation
sentry-rust copied to clipboard

context inferred "type" field not being respected

Open boxxxie opened this issue 3 years ago • 0 comments
trafficstars

reference docs: https://develop.sentry.dev/sdk/event-payloads/contexts/

The contexts type can be used to define arbitrary contextual data on the event. It accepts an object of key/value pairs. The key is the “alias” of the context and can be freely chosen. However, as per policy, it should match the type of the context unless there are two values for a type. You can omit type if the key name is the type.

You can omit type if the key name is the type.

the following contexts do not require a "type" field when the name of their parent is the "type" Device Context OS Context Runtime Context App Context Browser Context GPU Context State Context Culture Context

Environment

sentry-cli --version                                                
sentry-cli 2.5.0

Steps to Reproduce

bug example:

{
  "contexts": {
    "device": {
      "name": "fancy name for a fancy server",
      "arch": "amd64",
      "num_cpu": 8
    },
}

working example:

{
  "contexts": {
    "device": {
      "type": "device",
      "name": "fancy name for a fancy server",
      "arch": "amd64",
      "num_cpu": 8
    },
}

Actual Result

sentry-cli send-event --no-environ "test_file.json" produces: error: missing field 'type' at line 7 column 5

boxxxie avatar Jul 21 '22 16:07 boxxxie