Skip to content

report: v1.12.0 fails to compile against sentry-go v0.46.0 (event.Extra removed) #158

@denniszag

Description

@denniszag

Problem

cockroachdb/errors v1.12.0 (and current master, commit 64801262) fails to typecheck when built against getsentry/sentry-go >= v0.46.0.

The root cause is a single line in report/report.go:369:

event.Extra[extraKey] = extraValue

sentry-go v0.46.0 (CHANGELOG, PR #1274) removed the Extra field from sentry.Event as a breaking change. cockroachdb/errors does not declare an upper bound on the sentry-go version, so any transitive upgrade propagates the compile error to every downstream consumer.

Repro

// go.mod
require (
    github.com/cockroachdb/errors v1.12.0
    github.com/getsentry/sentry-go v0.46.0
)
// main.go
package main

import "github.com/cockroachdb/errors"

func main() {
    _ = errors.New("x")
}
$ go build ./...
.../cockroachdb/errors@v1.12.0/report/report.go:369:9:
  event.Extra undefined (type *sentry.Event has no field or method Extra)

Blast radius

Because report_api.go in the root errors package imports the report sub-package, the typecheck failure blocks the entire module — not just the Sentry-reporting code path. Any project that imports github.com/cockroachdb/errors (directly or transitively) cannot build once sentry-go reaches v0.46.0.

Suggested fix

In report/report.go ReportError, replace the event.Extra write with the post-v0.46 equivalent. Options:

  1. Use Contexts (the replacement for per-event unstructured data):

    if event.Contexts == nil {
        event.Contexts = map[string]sentry.Context{}
    }
    event.Contexts[extraKey] = sentry.Context{"value": extraValue}
  2. Or, since BuildSentryReport already returns extraDetails as a separate map, drop the in-place merge inside ReportError and let callers attach extras via scope.SetContext (which is how sentry-go intends extras to be propagated in v0.46+).

Either approach should be scoped to report/report.go only — no other file in the module touches Event.Extra.

Related

Thanks for the library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions