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

Bug: Pagination breaks if the row used as cursor is deleted #1357

Closed
mafredri opened this issue May 10, 2022 · 3 comments
Closed

Bug: Pagination breaks if the row used as cursor is deleted #1357

mafredri opened this issue May 10, 2022 · 3 comments
Assignees
Labels
api Area: HTTP API
Milestone

Comments

@mafredri
Copy link
Member

mafredri commented May 10, 2022

This issue was pointed out by @spikecurtis in #1308 (comment).

Steps to Reproduce

  1. Set up coder server
  2. 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'
  3. Delete the template version row in the database where id = '49993e4e-a42f-40f3-96a8-636ac765833c'
  4. 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.

@tjcran
Copy link

tjcran commented May 16, 2022

Marking as a Community MVP bug so that we can check again once the related endpoints are completed to see if the issue still persists.

@Emyrk
Copy link
Member

Emyrk commented May 17, 2022

Behavior will be to hard error

@Emyrk
Copy link
Member

Emyrk commented Jun 2, 2022

Completed here: #1947

@Emyrk Emyrk closed this as completed Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Area: HTTP API
Projects
None yet
Development

No branches or pull requests

4 participants