Skip to content

context inferred "type" field not being respected #483

@boxxxie

Description

@boxxxie

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions