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

Avro validation returns 204 and produces blank message #1143

Closed
vordimous opened this issue Jul 11, 2024 · 0 comments · Fixed by #1157
Closed

Avro validation returns 204 and produces blank message #1143

vordimous opened this issue Jul 11, 2024 · 0 comments · Fixed by #1157
Assignees
Labels
bug Something isn't working

Comments

@vordimous
Copy link
Contributor

Describe the bug
JSON to Avro over HTTP is not behaving as expected:

  • Validation failures produce blank message
  • Validation failure only logs one missing attribute
  • Partial valid message logs unhelpful error "Expected string. Got END_OBJECT"

To Reproduce
sse avro example.zip

Steps to reproduce the behavior:

  • start example

    ./startup.sh
    
  • start stream

    curl --location --request GET 'http://localhost:7114/sse/stream' -v \
    --header 'Content-Type: text/plain' \
    --data '["NjNiNTU5Y2MtMjJhMC00YzMwLTgzOGMtZWE4OTZhOTBlMTQx","AQIABA=="]'
    
  • send good payload

    curl --location 'http://localhost:7114/sse/events' -v \
    --header 'Content-Type: application/json' \
    --data '{"id": "anID","status": "aStatus"}'
    
  • everything works

  • send bad payload

    curl --location 'http://localhost:7114/sse/events' -v \
    --header 'Content-Type: application/json' \
    --data '{"name": "a name"}'
    

    zilla-avro-sse.north_http_server [11/Jul/2024:15:00:56 +0000] BINDING_HTTP_REQUEST_ACCEPTED - POST http://localhost:7114/sse/events
    1720710056288:zilla-avro-sse south_kafka_client: Skipping invalid message on topic events-sse, partition 0, offset 2
    zilla-avro-sse.south_kafka_cache_server [11/Jul/2024:15:00:56 +0000] MODEL_AVRO_VALIDATION_FAILED A message payload failed validation. Expected field name not found: id
    zilla-avro-sse.south_kafka_client [11/Jul/2024:15:00:56 +0000] MODEL_AVRO_VALIDATION_FAILED A message payload failed validation.

  • send partial good

    curl --location 'http://localhost:7114/sse/events' -v \
    --header 'Content-Type: application/json' \
    --data '{"id": "anID"}'
    

    zilla-avro-sse.north_http_server [11/Jul/2024:15:02:34 +0000] BINDING_HTTP_REQUEST_ACCEPTED - POST http://localhost:7114/sse/events
    zilla-avro-sse.south_kafka_cache_server [11/Jul/2024:15:02:34 +0000] MODEL_AVRO_VALIDATION_FAILED A message payload failed validation. Expected string. Got END_OBJECT
    1720710154266:zilla-avro-sse south_kafka_client: Skipping invalid message on topic events-sse, partition 0, offset 3
    zilla-avro-sse.south_kafka_client [11/Jul/2024:15:02:34 +0000] MODEL_AVRO_VALIDATION_FAILED A message payload failed validation.

Expected behavior
It should not produce a message on failure. Validation failures return accurate HTTP error codes with reason and log appropriate failure reason.

Zilla Environment:
sse avro.zip

@vordimous vordimous added the bug Something isn't working label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants