"502: API Services rejected request with error" only when using "Enum.SortDirection.Descending"

When I try to list all versions of a key in my DataStore like my script in this post, I can get only 32 records:

  Key: 1 ; Version: 08D95B55B137117B.0000000E21.08D9BB4769B6733E.01 ; Created: 09/12/2021 19:09 ; Deleted: false
  Key: 2 ; Version: 08D95B55B137117B.0000000E22.08D9BB4A959F247A.01 ; Created: 09/12/2021 19:32 ; Deleted: false
  Key: 3 ; Version: 08D95B55B137117B.0000000E23.08D9BB53EA892DAD.01 ; Created: 09/12/2021 20:38 ; Deleted: false
  Key: 4 ; Version: 08D95B55B137117B.0000000E24.08D9BF0DD86B6B9B.01 ; Created: 14/12/2021 14:27 ; Deleted: false
  Key: 5 ; Version: 08D95B55B137117B.0000000E25.08D9C00BF43458EA.01 ; Created: 15/12/2021 20:46 ; Deleted: false
  Key: 6 ; Version: 08D95B55B137117B.0000000E26.08D9C00CB311042B.01 ; Created: 15/12/2021 20:51 ; Deleted: false
  Key: 7 ; Version: 08D95B55B137117B.0000000E27.08D9C00E525E43B7.01 ; Created: 15/12/2021 21:03 ; Deleted: false
  Key: 8 ; Version: 08D95B55B137117B.0000000E28.08D9C00EA7F2A11E.01 ; Created: 15/12/2021 21:05 ; Deleted: false
  Key: 9 ; Version: 08D95B55B137117B.0000000E29.08D9C02DE201FA53.01 ; Created: 16/12/2021 00:49 ; Deleted: false
  Key: 10 ; Version: 08D95B55B137117B.0000000E2A.08D9C088623D8BCB.01 ; Created: 16/12/2021 11:37 ; Deleted: false
  Key: 11 ; Version: 08D95B55B137117B.0000000E2B.08D9C088C0E51459.01 ; Created: 16/12/2021 11:39 ; Deleted: false
  Key: 12 ; Version: 08D95B55B137117B.0000000E2C.08D9C08FD2FC231E.01 ; Created: 16/12/2021 12:30 ; Deleted: false
  Key: 13 ; Version: 08D95B55B137117B.0000000E2D.08D9C0989119CF2B.01 ; Created: 16/12/2021 13:32 ; Deleted: false
  Key: 14 ; Version: 08D95B55B137117B.0000000E2E.08D9C09A8180AA0A.01 ; Created: 16/12/2021 13:46 ; Deleted: false
  Key: 15 ; Version: 08D95B55B137117B.0000000E2F.08D9C09BB4C3E974.01 ; Created: 16/12/2021 13:55 ; Deleted: false
  Key: 16 ; Version: 08D95B55B137117B.0000000E30.08D9C09C3C708E2E.01 ; Created: 16/12/2021 13:59 ; Deleted: false
  Key: 17 ; Version: 08D95B55B137117B.0000000E31.08D9C09D722CF230.01 ; Created: 16/12/2021 14:07 ; Deleted: false
  Key: 18 ; Version: 08D95B55B137117B.0000000E32.08D9C09DF4597062.01 ; Created: 16/12/2021 14:11 ; Deleted: false
  Key: 19 ; Version: 08D95B55B137117B.0000000E33.08D9C0A2D2B741C5.01 ; Created: 16/12/2021 14:46 ; Deleted: false
  Key: 20 ; Version: 08D95B55B137117B.0000000E34.08D9C15B40C7C960.01 ; Created: 17/12/2021 12:46 ; Deleted: false
  Key: 21 ; Version: 08D95B55B137117B.0000000E35.08D9C19FE09B93B1.01 ; Created: 17/12/2021 20:57 ; Deleted: false
  Key: 22 ; Version: 08D95B55B137117B.0000000E36.08D9C1A015327026.01 ; Created: 17/12/2021 20:59 ; Deleted: false
  Key: 23 ; Version: 08D95B55B137117B.0000000E37.08D9C1A04A1DD16F.01 ; Created: 17/12/2021 21:00 ; Deleted: false
  Key: 24 ; Version: 08D95B55B137117B.0000000E38.08D9C32A15577A32.01 ; Created: 19/12/2021 19:59 ; Deleted: false
  Key: 25 ; Version: 08D95B55B137117B.0000000E39.08D9C33CB0DFF8AA.01 ; Created: 19/12/2021 22:12 ; Deleted: false
  Key: 26 ; Version: 08D95B55B137117B.0000000E3A.08D9C3B33A42D7B7.01 ; Created: 20/12/2021 12:21 ; Deleted: false
  Key: 27 ; Version: 08D95B55B137117B.0000000E3B.08D9C3B35711CDA8.01 ; Created: 20/12/2021 12:22 ; Deleted: false
  Key: 28 ; Version: 08D95B55B137117B.0000000E3C.08D9C3B35EB17306.01 ; Created: 20/12/2021 12:22 ; Deleted: false
  Key: 29 ; Version: 08D95B55B137117B.0000000E3D.08D9C3B3AE35F183.01 ; Created: 20/12/2021 12:24 ; Deleted: false
  Key: 30 ; Version: 08D95B55B137117B.0000000E3E.08D9C3B3C20EDAF0.01 ; Created: 20/12/2021 12:25 ; Deleted: false
  Key: 31 ; Version: 08D95B55B137117B.0000000E3F.08D9C3B3DB8D3351.01 ; Created: 20/12/2021 12:25 ; Deleted: false
  Key: 32 ; Version: 08D95B55B137117B.0000000E40.08D9C3B3EA521D0A.01 ; Created: 20/12/2021 12:26 ; Deleted: false

… but when I try the same with sorting Descending (DataStore:ListVersionsAsync("Jogo", Enum.SortDirection.Descending))

… I get only 4 records and then this error:

  Key: 1 ; Version: 08D95B55B137117B.0000001308.08D9D15B24DA5C8A.01 ; Created: 06/01/2022 21:26 ; Deleted: false
  Key: 2 ; Version: 08D95B55B137117B.0000001307.08D9D15929F4EA7C.01 ; Created: 06/01/2022 21:11 ; Deleted: false
  Key: 3 ; Version: 08D95B55B137117B.0000001306.08D9D132CCA30C16.01 ; Created: 06/01/2022 16:37 ; Deleted: false
  Key: 4 ; Version: 08D95B55B137117B.0000001305.08D9D132B87C0238.01 ; Created: 06/01/2022 16:36 ; Deleted: false
  502: API Services rejected request with error. HTTP 500 (Internal Server Error)
  1. Why can I list only 32 records on the first case?
  2. Why can I list only 4 records and the this error on the second case?

You forgot to :AdvanceToNextPageAsync().

1 Like