[GOT-64] Avoid returning 404 if read-query statement returns 0 rows #311
Labels
help wanted
Extra attention is needed
linear
Sync issue with linear
question
Further information is requested
Some days ago, I was looking at error level logs in the validator, and I noticed a couple of
"Rows not found"
messages.These came from
/query
API calls with read queries that result in 0 rows. It wasn't reasonable to log an error level message in this case since it's fine that users will make read queries with empty results, so the log line was removed to avoid noise in logs.Apart from that, while chatting with @brunocalza about this case, we have the sensation that the API shouldn't be returning
StatusNotFound
either see here.If we receive a read-query that returns an empty result, it'd seem OK to return a 200 status code with an empty result. Technically speaking, the read-query executed fine, and the correct result is empty. That's maybe the intention of the read-query: checking if the result is empty. If that was the case, the user is getting a 404 status code which seems odd.
We don't remember if this was done on purpose, so maybe has a good reason. Also, this is a breaking change since some people might be relying on the 404 behavior today.
We're surfacing this situation here for further discussion since some other API changes are coming so it's worth bundling it with them.
cc @sanderpick @carsonfarmer @joewagner @awmuncy @dtbuchholz
GOT-64
The text was updated successfully, but these errors were encountered: