openziti / edge

Application-embedded connectivity and zero-trust components
Apache License 2.0
75 stars 19 forks source link

Bad query to controller results in 500 not 400 level error #429

Closed dovholuknf closed 3 years ago

dovholuknf commented 3 years ago

I used the CLI to try to page

ziti edge list services "true limit 2 offset 2"
error: error listing https://wsl2-edge-controller:1280/services?filter=true+limit+2+offset+2 in Ziti Edge Controller. Status code: 500 Internal Server Error, Server returned: {"error":{"cause":{"code":"UNHANDLED","message":"Unexpected symbol: \"offset\" at line: 1 column: 13. line: 1, column: 13, symbol: offset"},"code":"UNHANDLED","message":"An unhandled error occurred","requestId":"kcs-..AB8"},"meta":{"apiEnrolmentVersion":"0.0.1","apiVersion":"0.0.1"}}

ziti edge list services "true limit 2 page 2"
error: error listing https://wsl2-edge-controller:1280/services?filter=true+limit+2+page+2 in Ziti Edge Controller. Status code: 500 Internal Server Error, Server returned: {"error":{"cause":{"code":"UNHANDLED","message":"Unexpected symbol: \"page\" at line: 1 column: 13. line: 1, column: 13, symbol: page"},"code":"UNHANDLED","message":"An unhandled error occurred","requestId":"8.OnD.MB8"},"meta":{"apiEnrolmentVersion":"0.0.1","apiVersion":"0.0.1"}}

these should be 400 errors and not 500's since the user made the mistake

plorenz commented 3 years ago

These now return http 480 invalid filter:

plorenz@carrot:~/work/nf$ ziti edge list services "true limit 2 offset 2"
error: error listing https://localhost:1280/services?filter=true+limit+2+offset+2 in Ziti Edge Controller. Status code: 480 status code 480, Server returned: {"error":{"cause":{"code":"UNHANDLED","message":"Unexpected symbol: \"offset\" at line: 1 column: 13. line: 1, column: 13, symbol: offset"},"code":"INVALID_FILTER","message":"The filter query supplied is invalid","requestId":"9vyoGOW-f"},"meta":{"apiEnrolmentVersion":"0.0.1","apiVersion":"0.0.1"}}
plorenz@carrot:~/work/nf$ ziti edge list services "true limit 2 page 2"
error: error listing https://localhost:1280/services?filter=true+limit+2+page+2 in Ziti Edge Controller. Status code: 480 status code 480, Server returned: {"error":{"cause":{"code":"UNHANDLED","message":"Unexpected symbol: \"page\" at line: 1 column: 13. line: 1, column: 13, symbol: page"},"code":"INVALID_FILTER","message":"The filter query supplied is invalid","requestId":"sT.B1-WO3"},"meta":{"apiEnrolmentVersion":"0.0.1","apiVersion":"0.0.1"}}