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

HEAD /object/authenticated/<bucket>/not_found should use status code 404 #323

Open
2 tasks done
Xuanwo opened this issue May 4, 2023 · 3 comments · May be fixed by #324
Open
2 tasks done

HEAD /object/authenticated/<bucket>/not_found should use status code 404 #323

Xuanwo opened this issue May 4, 2023 · 3 comments · May be fixed by #324
Labels
bug Something isn't working

Comments

@Xuanwo
Copy link

Xuanwo commented May 4, 2023

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

supabase storage will return 400 error code for HEAD request while object not found.

To Reproduce

https://github.com/supabase/storage-api/blob/1794d04ab0e7259d9058293e257f442015252ec3/src/storage/renderer/renderer.ts#L45-L52

Expected behavior

The status code should be 404 since HEAD request will not have a body and there is no way for client to know what happened.

Screenshots

None

System information

Not related

Additional context

apache/opendal#2200

@xyjixyjixyji
Copy link

Actually the metadata like the status code 404 should be returned in the header for most requests instead of in the body. Currently I found that supabase always returns 400 in the header and stores its actual status_code in the body.

I am curious about the reason under the hood :)

@fenos
Copy link
Contributor

fenos commented May 11, 2023

Returning 400 instead of 404 was a legacy decision to force the user to branch error handling with the response code.
It is arguably not semantically correct as you mentioned.

We are happy to rethink our error handling status code for the next version and return the correct status code

@Xuanwo
Copy link
Author

Xuanwo commented May 11, 2023

We are happy to rethink our error handling status code for the next version and return the correct status code

Thanks! The most confusing thing here is HEAD can't return a body so users don't need what error happened.

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
3 participants