Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deserialization Panic when receiving 401 when getting schema #1382

Open
jmjesperson opened this issue Jan 15, 2025 · 0 comments
Open

Deserialization Panic when receiving 401 when getting schema #1382

jmjesperson opened this issue Jan 15, 2025 · 0 comments

Comments

@jmjesperson
Copy link

v.2.8.0

I have narrowed the issue to schemaregistry/serde/protobuf/progobuf.go:521-530:

func (s *Deserializer) DeserializeInto(topic string, payload []byte, msg interface{}) error {
	result, err := s.deserialize(topic, payload, msg)
	// Copy the result into the target since we may have created a clone during transformations
	value := reflect.ValueOf(msg)
	if value.Kind() == reflect.Pointer {
		rv := value.Elem()
		rv.Set(reflect.ValueOf(result).Elem())
	}
	return err
}

I am getting a schema registry request failed error code: 401: Unauthorized in the err variable when s.GetSchema(topic, payload) is called.

I would expect the err to be returned before value := reflect.ValueOf(msg). Because an error is not returned when running line 527 (rv.Set(reflect.ValueOf(result).Elem())) it results in a panic.

Here is part of the trace...

panic: reflect: call of reflect.Value.Elem on zero Value

goroutine 121 [running]:
reflect.Value.Elem({0x0, 0x0, 0x0})
	/.../go/pkg/mod/golang.org/[email protected]/src/reflect/value.go:1262 +0x2fc
github.com/confluentinc/confluent-kafka-go/v2/schemaregistry/serde/protobuf.(*Deserializer).DeserializeInto(0x14000dca050, {0x14000da2e40, 0x38}, {0x140009e8000, 0x1b2, 0x1b2}, {0x10bb9b800, 0x140005f75e0})
	/.../go/pkg/mod/github.com/confluentinc/confluent-kafka-go/[email protected]/schemaregistry/serde/protobuf/protobuf.go:527 +0x124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant