question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
carlesarnalcommented, Nov 18, 2020

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.

1reaction
EricWittmanncommented, Nov 17, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

json - What is "406-Not Acceptable Response" in HTTP?
Your backend service is saying that the response type it is returning is not provided in the Accept HTTP header in your Client...
Read more >
406 Not Acceptable: What It Is and How to Fix It - Airbrake Blog
The Accept- header indicates to the server a valid response can only contain certain types of information.
Read more >
How to Fix a 406 Error and Find the Source of the Problem
The primary way to address and fix a 406 error is by checking the source code for issues in the Accept-, Request-, and...
Read more >
406 Not Acceptable - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 406 Not Acceptable client error response code indicates that the server cannot produce a response ...
Read more >
406 - error during API call when I add Accept : text/xml to request
it means that "The 'Accept' header of the request requires a response media type that is not supported." The only documentation I could...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found