schema-registry-ui icon indicating copy to clipboard operation
schema-registry-ui copied to clipboard

Connectivity error with schema registry 5.2.1

Open fhuertas opened this issue 5 years ago • 13 comments

I'm trying to connect to schema registry ui but I cannot.

I'm using the schema registry provided by the confluent cli (https://docs.confluent.io/current/cli/index.html).

I have tried with docker with the following command docker run --rm -p 8000:8000 -e "SCHEMEGISTRY_URL=http://localhost:8081" --network host landoop/schema-registry-ui and with compiled code

    git clone https://github.com/Landoop/schema-registry-ui.git
    cd schema-registry-ui
    npm install
    npm start

The env.js file for the compiled code is the following:

var clusters = [
  {
    NAME: "My Schema registry",
    // Schema Registry service URL (i.e. http://localhost:8081)
    SCHEMA_REGISTRY: "http://localhost:8081", // https://schema-registry.demo.landoop.com
    allowTransitiveCompatibilities: true  
  }
];

In both cases, the result is the same connectivity error. Screenshot from 2019-05-29 19-50-08

I have tried to register a new schema with the curl command generated by the ui and the message has been the following

// Register new schema
$ curl -vs --stderr - -XPOST -i -H "Content-Type: application/vnd.schemaregistry.v1+json" --data '{"schema":"\"{\n \\"type\\": \\"record\\",\n \\"name\\": \\"evolution\\",\n \\"doc\\": \\"This is a sample Avro schema to get you started. Please edit\\",\n \\"namespace\\": \\"com.landoop\\",\n \\"fields\\": [\n {\n \\"name\\": \\"name\\",\n \\"type\\": \\"string\\"\n },\n {\n \\"name\\": \\"number1\\",\n \\"type\\": \\"int\\"\n },\n {\n \\"name\\": \\"number2\\",\n \\"type\\": \\"float\\"\n }\n ]\n}\""}' http://localhost:8081/subjects/aaa/versions
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8081 (#0)
> POST /subjects/aaa/versions HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Type: application/vnd.schemaregistry.v1+json
> Content-Length: 408
> 
* upload completely sent off: 408 out of 408 bytes
< HTTP/1.1 400 Bad Request
HTTP/1.1 400 Bad Request
< Date: Wed, 29 May 2019 17:51:50 GMT
Date: Wed, 29 May 2019 17:51:50 GMT
< Content-Type: text/plain
Content-Type: text/plain
< Content-Length: 209
Content-Length: 209
< Server: Jetty(9.4.14.v20181114)
Server: Jetty(9.4.14.v20181114)

< 
Unexpected character ('t' (code 116)): was expecting comma to separate Object entries
 at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 22]* Connection #0 to host localhost left intact

However I have register a schema with the following command:

$ curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json"     --data '{"schema": "{\"type\": \"string\"}"}'     http://localhost:8081/subjects/Kafka-key/versions
{"id":1}

fhuertas avatar May 29 '19 17:05 fhuertas

+1

etos avatar Jun 06 '19 17:06 etos

+1

Dr-kyle avatar Jun 14 '19 07:06 Dr-kyle

+1

DaveOps83 avatar Jun 26 '19 14:06 DaveOps83

+1

piotr-yuxuan avatar Jul 12 '19 22:07 piotr-yuxuan

The solution is to edit and add 2 lines in the schema registry properties

vim etc/schema-registry/schema-registry.properties

Add the following 2 lines

access.control.allow.methods=GET,POST,PUT,OPTIONS
access.control.allow.origin=*

And then start via bin/./confluent start

Antwnis avatar Jul 13 '19 09:07 Antwnis

The solution is to edit and add 2 lines in the schema registry properties

vim etc/schema-registry/schema-registry.properties

Add the following 2 lines

access.control.allow.methods=GET,POST,PUT,OPTIONS
access.control.allow.origin=*

And then start via bin/./confluent start

Hi,

I am hosting the schema-registry which the version of image is also 5.2.1 on kubernetes deployed by helm chart, and I have tried to host a schema-registry-ui by helm chart with the following command:

helm install stable/schema-registry-ui --version 0.4.0 --namespace namespace --name name --set schemaRegistry.url=http://[kubernetes service ip address]

However, the ui returned CONNECTIVITY ERROR after starting up. Also, I have tried to enable the CORS and downgrade the image version to 5.0.2, but the ui still cannot connect to schema-registry.

Is there any solution or suggestion of this trouble?

p768lwy3 avatar Jul 18 '19 14:07 p768lwy3

HI, did anyone find a workaround? Is this project still maintained? It's a bit sad as this problem doesn't look big, maybe there is a quick fix. I didn't find anything yet. I tried schema registry 5.2.* and 5.3.*, not working. It's also working if I do the curl from @fhuertas from the container that runs schema-registry-ui :(

mthoretton avatar Aug 09 '19 09:08 mthoretton

In a container, you'd use the following environment variables

SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_METHODS=GET,POST,PUT,OPTIONS
SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_ORIGIN='*' 

OneCricketeer avatar Nov 09 '19 01:11 OneCricketeer

Same error for me with Kafka 5.3.1 and lastest schema-registry-ui (0.9.5).

Docker compose with settings suggered by @cricket007 :

    schema-registry-ui:
      image: landoop/schema-registry-ui
      container_name: schema-registry-ui
      depends_on:
        - schema-registry
      ports:
        - 8000:8000
      environment:
        SCHEMAREGISTRY_URL: "http://schema-registry:8081"


    schema-registry:
      image: confluentinc/cp-schema-registry:5.3.1
      container_name: schema-registry
      depends_on:
        - zookeeper
        - kafka
      environment:
        SCHEMA_REGISTRY_HOST_NAME: schema-registry
        SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181
        SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_METHODS: GET,POST,PUT,OPTIONS
        SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_ORIGIN: '*' 

http://schema-registry:8081 or http://localhost:8081 => same error.

nicolasesprit avatar Jan 08 '20 14:01 nicolasesprit

I think you're missing the proxy setting

https://github.com/conduktor/kafka-stack-docker-compose/blob/adaed89009641ad490e0697697e47b35582b7619/full-stack.yml#L57

The property value from the UI container should not be localhost

OneCricketeer avatar Jan 08 '20 14:01 OneCricketeer

My bad !

Thank you very much @cricket007 . It works !

nicolasesprit avatar Jan 08 '20 14:01 nicolasesprit

I was trying to run schema-registry & schema-registry-ui locally, and the PROXY: "true" env var fixed my issue. Thanks, @OneCricketeer.

ddaughertyrca avatar May 01 '20 15:05 ddaughertyrca

I think you're missing the proxy setting

https://github.com/conduktor/kafka-stack-docker-compose/blob/adaed89009641ad490e0697697e47b35582b7619/full-stack.yml#L57

The property value from the UI container should not be localhost

The ENV PROXY: "true" also fixed it for me. Thanks @OneCricketeer

imonteroq avatar Sep 07 '22 22:09 imonteroq