alpreu opened a new issue, #18253:
URL: https://github.com/apache/pulsar/issues/18253

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Motivation
   
   When sending invalid JSON to the `pulsar-functions-worker` API the response 
from the server looks like this:
   
   ```
   {"servlet":"org.glassfish.jersey.servlet.ServletContainer-53f0d09c",
   "message":"Bad Request",
   "url":"/admin/v3/sinks/public/default/SinkTest",
   "status":"400"}
   ```
   
   The problem here is that there is no descriptive error message that shows 
the user that the sent JSON is either broken or could not be mapped correctly.
   
   To reproduce the issue, start Pulsar in standalone mode and send an invalid 
`sinkConfig` json to the sink creation endpoint:
   
   ```
   curl -X "POST" 
"http://localhost:8080/admin/v3/sinks/public/default/SinkTest"; \
       -H "Accept: application/json" \
       -H 'Content-Type: multipart/form-data; charset=utf-8; 
boundary=__X_PAW_BOUNDARY__' \
       -F "sinkConfig={\"xyz\"};type=application/json" -vvv
   ```
   
   ### Solution
   
   The solution is to override the default `ExceptionMapper` from Jersey. 
   Unfortunately,this seems to be a rather difficult problem, as we also 
include `jersey-media-multipart` and `jersey-media-json-jackson`:
   https://stackoverflow.com/a/30371823
   
   
   
   
   ### Alternatives
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to