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

Schema Registry misleading error message when unauthorized #1257

Open
3 of 7 tasks
Benny93 opened this issue Jul 9, 2024 · 0 comments
Open
3 of 7 tasks

Schema Registry misleading error message when unauthorized #1257

Benny93 opened this issue Jul 9, 2024 · 0 comments

Comments

@Benny93
Copy link

Benny93 commented Jul 9, 2024

Description

When registering a new schema against the schema registry and I am not authorized I get a misleading error message:
invalid character '<' looking for beginning of value
Instead of 401 unauthorized.
Because
`defer resp.Body.Close()
if resp.StatusCode == 200 {
if err = json.NewDecoder(resp.Body).Decode(response); err != nil {
return err
}
return nil
}

var failure RestError
if err := json.NewDecoder(resp.Body).Decode(&failure); err != nil {
	return err
}

`
is parsing the response body as json right away.
In my case the unauthorized response body contains html.

How to reproduce

  • Set the schema registry up to require authentication
  • Register a new schema without credentials

Checklist

Please provide the following information:

  • confluent-kafka-go and librdkafka version (LibraryVersion()): v2.3.0
  • Apache Kafka broker version: quay.io/strimzi/kafka:0.38.0-kafka-3.6.0 / confluentinc/cp-schema-registry:7.0.9
  • Client configuration: ConfigMap{...} :
  • Operating system: Ubuntu 20.04.6 LTS (Focal Fossa)
  • Provide client logs (with "debug": ".." as necessary)
  • Provide broker log excerpts
  • Critical issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants