treeverse / lakeFS

lakeFS - Data version control for your data lake | Git for data
https://docs.lakefs.io
Apache License 2.0
4.46k stars 359 forks source link

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

Open yonipeleg33 opened 5 months ago

yonipeleg33 commented 5 months ago

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

N-o-Z commented 5 months ago

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.

yonipeleg33 commented 5 months ago

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

N-o-Z commented 5 months ago

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

Thanks!