Skip to content

Commit 660dfdc

Browse files
authored
fix: default page param to 1 in funnel step sessions and goal sessions (#940)
When the `page` query parameter is omitted, the offset calculation `(page - 1) * (limit || 25)` produces NaN, which causes the ClickHouse query to fail with a 500 error. Default `page` to 1 so both endpoints work without an explicit page param, matching the behavior of other paginated endpoints like getSessions. Fixes #939
1 parent b6310de commit 660dfdc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

server/src/api/analytics/funnels/getFunnelStepSessions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export async function getFunnelStepSessions(req: FastifyRequest<GetFunnelStepSes
259259
query_params: {
260260
siteId: Number(siteId),
261261
limit: limit || 25,
262-
offset: (page - 1) * (limit || 25),
262+
offset: ((page || 1) - 1) * (limit || 25),
263263
},
264264
});
265265

server/src/api/analytics/goals/getGoalSessions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export async function getGoalSessions(req: FastifyRequest<GetGoalSessionsRequest
166166
query_params: {
167167
siteId: Number(siteId),
168168
limit: limit || 25,
169-
offset: (page - 1) * (limit || 25),
169+
offset: ((page || 1) - 1) * (limit || 25),
170170
},
171171
});
172172

0 commit comments

Comments
 (0)