open-payments icon indicating copy to clipboard operation
open-payments copied to clipboard

Return 404 for empty list

Open wilsonianb opened this issue 2 years ago • 1 comments

or make startCursor/endCursor optional https://github.com/interledger/open-payments/blob/f1b51c3c051c9030cea1f3d2542cfb492c4330d3/openapi/resource-server.yaml#L1242-L1270

Open Payments list endpoints currently return

local-peer-backend-1     | {
local-peer-backend-1     |   status: 200,
local-peer-backend-1     |   message: 'OK',
local-peer-backend-1     |   header: [Object: null prototype] {
local-peer-backend-1     |     'content-type': 'application/json; charset=utf-8'
local-peer-backend-1     |   },
local-peer-backend-1     |   body: {
local-peer-backend-1     |     pagination: { hasPreviousPage: false, hasNextPage: false },
local-peer-backend-1     |     result: []
local-peer-backend-1     |   }
local-peer-backend-1     | }

which causes

local-peer-backend-1     |   InternalServerError: response.pagination must have required property 'startCursor'
local-peer-backend-1     |       at Object.throw (/workspace/node_modules/.pnpm/[email protected]/node_modules/koa/lib/context.js:97:11)
local-peer-backend-1     |       at /workspace/packages/openapi/dist/middleware.js:32:26
local-peer-backend-1     |       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
local-peer-backend-1     |       at async /workspace/packages/backend/dist/open_payments/payment_pointer/middleware.js:16:9
local-peer-backend-1     |       at async bodyParser (/workspace/node_modules/.pnpm/[email protected]/node_modules/koa-bodyparser/index.js:95:5)

wilsonianb avatar Jan 26 '23 20:01 wilsonianb

I think we should make the startCursor/endCursor optional

sabineschaller avatar Mar 29 '23 10:03 sabineschaller

startCursor & endCursor already optional

mkurapov avatar Oct 02 '24 13:10 mkurapov