Hi,

I am trying to upload a schema to the registry for server side message 
validation in a 
[standalone-docker](https://pulsar.apache.org/docs/en/standalone-docker/) 
following the instructions on but all attempts result in a 500 Internal Server 
Error.

At the very least there is an improvement to be made in the error message and 
logs but I am starting to suspect that there is a bug

Before I file a report, any suggestions on what I might be doing wrong?

Cheers,

Chris

# Steps to reproduce

1. Run Pulsar 
[standalone-docker](https://pulsar.apache.org/docs/en/standalone-docker/)

                docker run -it \
                  -p 6650:6650 \
                  -p 8080:8080 \
                  -v $PWD/data:/pulsar/data \
                  apachepulsar/pulsar:2.4.1 \
                  bin/pulsar standalone

1. Produce messages to a public/default/my-topic ensuring that the 
`public/default/my-topic` exists:

                python3 - <<EOF
                import pulsar

                client = pulsar.Client('pulsar://localhost:6650')
                producer = client.create_producer('my-topic')

                for i in range(10):
                    producer.send(('hello-pulsar-%d' % i).encode('utf-8'))

                client.close()
                EOF

1. Create empty schema accepting all JSON

                curl -i -X POST \
                  
http://localhost:8080/admin/v2/schemas/public/default/my-topic/schema \
                  -H 'Content-Type: application/json' \
                  -H 'Host: localhost:8080' \
                  -d '{
                  "name": "Test",
                  "type": "JSON",
                  "schema": "{ }",
                  "properties": { }
                }
                '

# Expected result

* `200 OK` if there is nothing wrong in the sequence above
* `409 Conflict` if there is a configuration error for the tenant, namespace or 
topic with a clear indication of the problem
* `500 Internal Server Error` if this there is a real bug in the code with a 
stack trace logged at `ERROR` level

In addition

* Error messages should be in `text/plain` or possibly `application/json`; 
ideally the `Accept` header is respected.

# Actual result

                HTTP/1.1 500 Internal Server Error
                Content-Type: text/html;charset=iso-8859-1
                Content-Length: 388
                Server: Jetty(9.4.12.v20180830)

                <html>
                <head>
                <meta http-equiv="Content-Type" 
content="text/html;charset=utf-8"/>
                <title>Error 500 Internal Server Error</title>
                </head>
                <body><h2>HTTP ERROR 500</h2>
                <p>Problem accessing 
/admin/v2/schemas/public/default/my-topic/schema. Reason:
                <pre>    Internal Server Error</pre></p><hr><a 
href="http://eclipse.org/jetty";>Powered by Jetty:// 9.4.12.v20180830</a><hr/>

                </body>
                </html>

The only log is the request, no stack trace and not other errors, warnings or 
info messages:

                20:17:13.964 [pulsar-web-57-12] INFO 
org.eclipse.jetty.server.RequestLog - 172.17.0.1 - - [01/Dec/2019:20:17:13 
+0000] "POST /admin/v2/schemas/public/default/my-topic/schema HTTP/1.1" 500 388 
"-" "PostmanRuntime/7.17.1" 9

Reply via email to