-
Notifications
You must be signed in to change notification settings - Fork 95
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
gateway: unify root identifier resolution errors #185
Comments
We will do follow-up in ipfs/boxo#185
@lidel I completely agree. It's very hard to detect where these errors are coming from without changing a lot of libraries and ensuring we clearly bubble up the errors. I will work on the code to make all requests return HTTP 500 here. |
400 bad request is more appropriate for a CID that the server cannot parse since the server defines what request semantics it supports. The server hasn't failed and the user should not retry the request. A 500 response indicates to the user that they can retry it and expect it to work when the server has recovered. |
As I mentioned in Slack, I think we could keep |
@hacdias do you mind filling an issue for this so we tackle it after #176 ? (unless you've found an easy fix – maybe detect CID parsing errors in I hoped this will be cosmetic, but this will be coming back, just like did for the opposite "why 400 on /ipns/, my domain is ok". |
I was thinking about this again, both from semantic perspective, but also given your feedback on how hairy this gets.
I am leaning towards returning 500s for all invalid root identifiers, just for the sake of consistency and simplicity
@hacdias would like to hear your thoughts if below makes sense (if you dont have any concerns, feel free to execute on this):
/ipfs/this-is-not-a-cid
→ we were thinking about 400 Bad Request, but it may be better/easier to return 500 Server Error, because maybe today we know this CID is not valid, but in 10 years the same software could be wrong? Maybe it is a valid CIDv8 that this old software can't recognize? 400 could be wrong, 500 will always kinda fit./ipns/this-domain-does-not-exist
→ 500 (we dont know if domain does not exist, or was resolution error)/ipns/{cid-libp2p-key-that-cant-be-resolved}
→ 500 (if it is a valid key, resolution error, if not, we will fallbck to dnslink, and that also cant be proven negative)TLDR
Return HTTP 500 Server Error for all
/ip[nf]s/id
failures.TODO
IsErrNotFound
func probably should not haverouting.ErrNotFound
, because these errors are for /ipns/id, which is we always want to be 500.The text was updated successfully, but these errors were encountered: