News for hackers. Stuff that matters.
Re:Monitoring tiny web services by Spivak on Saturday July 09, 2022 @07:05PM (#32040163)
I actually think I agree with your former self, how do you tell the difference between a server and an application error? How do you tell the difference between "record not found" and "there is no GraphQL endpoint here at all"? Or "you are not allowed to access GraphQL" and "you are not allowed to access the server."

Especially because error responses from your web server layer are usually really different than errors from your backends.

Re:Monitoring tiny web services by remram on Saturday July 09, 2022 @09:34PM (#32041064)
> How do you tell the difference between "record not found" and "there is no GraphQL endpoint here at all"?

The standard 503 and 404 codes?

Re:Monitoring tiny web services by Spivak on Saturday July 09, 2022 @09:43PM (#32041107)
503 doesn’t map well to me meaning “you performed a successful GraphQL query but the result is that the thing you tried to query is missing.”
Re:Monitoring tiny web services by remram on Saturday July 09, 2022 @10:57PM (#32041444)
Yes that would be 404.

Similar to how there's no difference between "there's no /pets/" or "there is no /pet/15", they are both 404 for /pets/15

400 is also a good code for "your query doesn't make sense". Anything but 200 really.

Re:Monitoring tiny web services by AdieuToLogic on Sunday July 10, 2022 @05:52AM (#32043258)
While using HTTP status codes could work for GraphQL payloads which have only one operation in them, this approach would not work for those which have multiple[0].

0 - http://spec.graphql.org/October2021/#sec-Executing-Requests

Re:Monitoring tiny web services by remram on Sunday July 10, 2022 @11:02AM (#32045389)
207 has been used for that for decades. GraphQL looks like it's been implemented by someone who thought 200 and 404 were the only possible codes.
Re:Monitoring tiny web services by AdieuToLogic on Sunday July 10, 2022 @08:28PM (#32050776)
> 207 has been used for that for decades.

That's a WebDAV status code.

> GraphQL looks like it's been implemented by someone who thought 200 and 404 were the only possible codes.

Maybe. Or maybe they decided that a 2xx status would be interpreted as "success" by a non-trivial set of libraries and/or systems. Either way, take it up with the standards committee :-).