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

REST API returning 406 error when "accept: application/json" header included in request #1007

Closed
zejji opened this issue Nov 15, 2020 · 5 comments
Assignees
Labels
type/bug Something isn't working

Comments

@zejji
Copy link

zejji commented Nov 15, 2020

I am running the Apicurio schema registry in Docker with the following configuration:

version: '3.8'
services:
...
  schema-registry:
    image: apicurio/apicurio-registry-kafka:1.3.1.Final
    container_name: schema-registry
    networks:
      - kafka
    depends_on:
      - zookeeper
      - kafka
    ports:
      - '8081:8081'
      - '9000'
    environment:
      QUARKUS_PROFILE: prod
      KAFKA_BOOTSTRAP_SERVERS: "kafka:29092"
      HTTP_PORT: '8081'
      APPLICATION_ID: schema-registry
      APPLICATION_SERVER_HOST: schema-registry
      APPLICATION_SERVER_PORT: '9000'

When I make a GET request without an "Accept" request header, or with "accept: application/vnd.schemaregistry.v1+json", everything works fine:

$ curl --silent -X GET http://localhost:8081/api/ccompat/schemas/types
["JSON","PROTOBUF","AVRO"]

$ curl --silent -X GET http://localhost:8081/api/ccompat/schemas/types -H "accept: application/vnd.schemaregistry.v1+json"
["JSON","PROTOBUF","AVRO"]

However, when I use "accept: application/json", which should also work, I get a 406 error:

$ curl --silent -X GET http://localhost:8081/api/ccompat/schemas/types -H "accept: application/json"
{"message":"RESTEASY003635: No match for accept header","error_code":406}

This same issue means that I cannot use AKHQ as a GUI for the Apicurio schema registry - see this GitHub issue for some background. I think the issue lies with Apicurio rather than AKHQ because AKHQ works just fine when using the Confluent schema registry.

Hopefully this should be a relatively trivial issue to fix, but it would certainly be nice if the Apicurio schema registry accepted all the same content types as the Confluent implementation (see here) and also worked nicely with AKHQ.

Update:

I've attached a screenshot of the error in AKHQ below:
image

@EricWittmann
Copy link
Member

Thanks for the report. @carlesarnal I assume this is an easy fix, but could you dig into it and see what you can find?

@carlesarnal
Copy link
Member

Thanks for the report. @carlesarnal I assume this is an easy fix, but could you dig into it and see what you can find?

Hi @EricWittmann we're not supporting all the accept headers that confluent does, this has been fixed here.

@EricWittmann
Copy link
Member

Fixed in #1017

@zejji
Copy link
Author

zejji commented Nov 24, 2020

Many thanks - is the fix in the apicurio/apicurio-registry-kafka:1.3.2.Final Docker image?

I've just tested that image together with AKHQ but I'm still getting the same error in AKHQ shown in the image above. Unfortunately I'm not a Java developer so I haven't had any success logging the exact requests and responses that are triggering the error.

Is there any way to configure Apicurio registry to log full requests and responses? I should then be able to provide more information re exactly what is going wrong.

@EricWittmann
Copy link
Member

No sorry, the fix was made on master and will be available in the next major release. You can try to use the latest docker image to see the fix.

Also please note that the -kafka variant of registry has been deprecated for some time (in favor of the -streams variant) and has been removed in master. I would recommend this:

https://hub.docker.com/layers/apicurio/apicurio-registry-streams/latest/images/sha256-d3bfb0d13498dedd563d7b45dfa2461e560bf0fbf08ff3767254bb8a198f4845?context=explore

I believe configuration options are mostly the same. More info here:

https://github.com/Apicurio/apicurio-registry#streams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants