diff --git a/go.mod b/go.mod index 73fefe3e5..cb857682b 100644 --- a/go.mod +++ b/go.mod @@ -74,7 +74,7 @@ require ( github.com/golang-jwt/jwt/v5 v5.2.1 github.com/googleapis/go-sql-spanner v1.8.0 github.com/gosimple/slug v1.14.0 - github.com/hamba/avro/v2 v2.22.2-0.20240625062549-66aad10411d9 + github.com/hamba/avro/v2 v2.27.0 github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c github.com/jackc/pgx/v4 v4.18.3 github.com/jackc/pgx/v5 v5.6.0 diff --git a/go.sum b/go.sum index bd0f0ba55..3ae00913b 100644 --- a/go.sum +++ b/go.sum @@ -1319,8 +1319,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjw github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= -github.com/hamba/avro/v2 v2.22.2-0.20240625062549-66aad10411d9 h1:NEoabXt33PDWK4fXryK4e+XX+fSKDmmu9vg3yb9YI2M= -github.com/hamba/avro/v2 v2.22.2-0.20240625062549-66aad10411d9/go.mod h1:fQVdB2mFZBhPW1D5Abej41LMvrErARGrrdjOnKbm5yw= +github.com/hamba/avro/v2 v2.27.0 h1:IAM4lQ0VzUIKBuo4qlAiLKfqALSrFC+zi1iseTtbBKU= +github.com/hamba/avro/v2 v2.27.0/go.mod h1:jN209lopfllfrz7IGoZErlDz+AyUJ3vrBePQFZwYf5I= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= diff --git a/internal/impl/confluent/serde_hamba_avro.go b/internal/impl/confluent/serde_hamba_avro.go index 9b2383f47..ba19603cd 100644 --- a/internal/impl/confluent/serde_hamba_avro.go +++ b/internal/impl/confluent/serde_hamba_avro.go @@ -67,9 +67,10 @@ func (s *schemaRegistryDecoder) getHambaAvroDecoder(ctx context.Context, schema if err != nil { return fmt.Errorf("unable to extract bytes from message: %w", err) } - var native any - if err := avro.Unmarshal(codec, b, &native); err != nil { - return fmt.Errorf("unable to unmarshal avro: %w", err) + r := avro.NewReader(nil, 0).Reset(b) + native := r.ReadNext(codec) + if r.Error != nil { + return fmt.Errorf("unable to unmarshal avro: %w", r.Error) } var w avroSchemaWalker w.unnestUnions = s.cfg.avro.rawUnions