schema-registry-ui
schema-registry-ui copied to clipboard
Connectivity error with schema registry 5.2.1
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.
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}
+1
+1
+1
+1
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
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?
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 :(
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='*'
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.
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
My bad !
Thank you very much @cricket007 . It works !
I was trying to run schema-registry & schema-registry-ui locally, and the PROXY: "true"
env var fixed my issue. Thanks, @OneCricketeer.
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