burnstony#1975B
Convex Community11mo ago
3 replies
burnstony#1975

aggrea

I kept getting the below error
Math that I believed should always end up with an integer was sometimes not, I am still not sure if its a weird floating point thing or an actual mistake in my logic but either way casting to an int eliminated the error

const int_index = Math.floor((page - 1) * pageSize);
const { key } = await timeline_aggregate.at(ctx, int_index);
@lee thought you'd like to know that

Oops!


Sorry, an unexpected error has occurred.

[CONVEX
Q(page_timeline:pageOfTimeline)] [Request ID: 46915a3b4d2c7ff3] Server
Error
Uncaught ConvexError: Uncaught ConvexError: offset exceeded count by
-5.000000000001819 (in node j979aarwny50526j9thqpjy8g97bgp1a)
at atOffsetInNode
(../../../../node_modules/@convex-dev/aggregate/src/component/btree.ts:725:0)
at async atOffsetInNode
(../../../../node_modules/@convex-dev/aggregate/src/component/btree.ts:719:63)
at async atOffsetInNode
(../../../../node_modules/@convex-dev/aggregate/src/component/btree.ts:719:63)
at async atOffsetInNode
(../../../../node_modules/@convex-dev/aggregate/src/component/btree.ts:719:63)
at async atOffsetInNode
(../../../../node_modules/@convex-dev/aggregate/src/component/btree.ts:719:63)
at async atOffsetHandler
(../../../../node_modules/@convex-dev/aggregate/src/component/btree.ts:379:0)

at async at [as at]
(../../../../node_modules/@convex-dev/aggregate/src/client/index.ts:114:6)
at async handler (../../convex/page_timeline.ts:175:23)

Called by client
Was this page helpful?