- Notifications
You must be signed in to change notification settings - Fork928
Closed
Description
This issue was pointed out by@spikecurtis in#1308 (comment).
Steps to Reproduce
- Set up coder server
- Request a user or template version with the
after_id
:GET 'http://localhost:3000/api/v2/templates/b60ecd72-9b8a-492b-b30d-077cbee5e550/versions?limit=1&after_id=49993e4e-a42f-40f3-96a8-636ac765833c'
- Delete the template version row in the database where
id = '49993e4e-a42f-40f3-96a8-636ac765833c'
- Redo step 2
Expected
The API would return an error, all results or metadata related to pagination.
Actual
The API returns no results.
Notes
We're not actively using pagination yet, so this is not an immediate problem and it may not ever be a problem for the aforementioned endpoints, but it's one that we should account for. The solution could be to either never delete rows from the database (only mark as deleted) or to query the database to verify that the cursor exists, either as part of the pagination query or separately.
Keep solution as simple as possible. Throw an error if you get into a situation like this.