lakeFS icon indicating copy to clipboard operation
lakeFS copied to clipboard

[Bug]: HEAD endpoints are not returning error messages in the response body

Open yonipeleg33 opened this issue 1 year ago • 3 comments

What happened?

Related to #7451

Steps to Reproduce: Running this code:

import lakefs

lakefs.Repository("<invalid-name>").branch("branch-name").object("something").exists()

Throws:

...
lakefs.exceptions.BadRequestException: code: 400, reason: Bad Request, body: {}

While running this code:

lakefs.Repository("<invalid-name>").branch("branch-name").object("something").stat()

Throws:

...
lakefs.exceptions.BadRequestException: code: 400, reason: Bad Request, body: {'message': 'argument repository: repository id: invalid value: validation error'}

The exists API calls HEAD /repositories/{repository}/refs/{ref}/objects, while the stat API does a GET request to the same endpoint. The HEAD request doesn't accept content in the response body, which contains crucial information about the failure reason.

Expected behavior

Both code snippets should produce the same exception:

lakefs.exceptions.BadRequestException: code: 400, reason: Bad Request, body: {'message': 'argument repository: repository id: invalid value: validation error'}

lakeFS version

No response

How lakeFS is installed

No response

Affected clients

No response

Relevant log output

No response

Contact details

No response

yonipeleg33 avatar Jun 18 '24 15:06 yonipeleg33

This is not a "Python Wrapper" issue. This is an issue with all of our clients. The reason is: head response does not return a body and as a result we don't get the full description of the error. Potentially we should somehow make the error description available in the lakeFS response also for head requests.

N-o-Z avatar Jun 18 '24 16:06 N-o-Z

@N-o-Z I see your point, changed the issue title accordingly.

yonipeleg33 avatar Jun 18 '24 17:06 yonipeleg33

@N-o-Z I see your point, changed the issue title accordingly.

Thanks!

N-o-Z avatar Jun 18 '24 17:06 N-o-Z