[PR #7166] [MERGED] fix: session listing endpoints returning empty arrays when >100 inactive sessions exist #32716

Closed
opened 2026-04-17 23:28:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7166
Author: @ping-maxwell
Created: 1/7/2026
Status: Merged
Merged: 2/28/2026
Merged by: @Bekacru

Base: canaryHead: fix/list-sessions-should-ignore-expired


📝 Commits (10+)

  • 0d76469 fix: list-session to ignore expired sessions
  • 0bdace6 Merge branch 'canary' into fix/list-sessions-should-ignore-expired
  • aaffbde chore: cleanup
  • ed8b7d3 Merge branch 'canary' into fix/list-sessions-should-ignore-expired
  • a313d9c Merge branch 'canary' into fix/list-sessions-should-ignore-expired
  • edc93dc Merge branch 'canary' into fix/list-sessions-should-ignore-expired
  • 6e31aee Merge branch 'canary' into fix/list-sessions-should-ignore-expired
  • 0d639a9 Merge branch 'canary' into fix/list-sessions-should-ignore-expired
  • 3149a1a Merge branch 'canary' into fix/list-sessions-should-ignore-expired
  • 10e1b8f Merge branch 'canary' into fix/list-sessions-should-ignore-expired

📊 Changes

4 files changed (+49 additions, -6 deletions)

View changed files

📝 packages/better-auth/src/api/routes/session.ts (+1 -0)
📝 packages/better-auth/src/db/internal-adapter.ts (+35 -3)
📝 packages/better-auth/src/plugins/multi-session/index.ts (+4 -2)
📝 packages/core/src/types/context.ts (+9 -1)

📄 Description

The /list-sessions endpoint and the /multi-session/list-device-sessions endpoint both return a list of active sessions. Both relying on the internal-adapter to fetch 100 sessions then using javascript to filter out expired ones. If there are over 100 inactive sessions than the returned result would be an empty array even if there are active sessions. This PR fixes this issue.

Discord: https://discord.com/channels/1288403910284935179/1458337328916463688


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7166 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 1/7/2026 **Status:** ✅ Merged **Merged:** 2/28/2026 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/list-sessions-should-ignore-expired` --- ### 📝 Commits (10+) - [`0d76469`](https://github.com/better-auth/better-auth/commit/0d76469b9d091963bfd4fcb2e43126efb6218a7f) fix: list-session to ignore expired sessions - [`0bdace6`](https://github.com/better-auth/better-auth/commit/0bdace6bd677c95611057a4f8655fb426e97b91b) Merge branch 'canary' into fix/list-sessions-should-ignore-expired - [`aaffbde`](https://github.com/better-auth/better-auth/commit/aaffbde567565cb60dcc18fabc78825fdb1bc474) chore: cleanup - [`ed8b7d3`](https://github.com/better-auth/better-auth/commit/ed8b7d303d0a81698ce4bc2fe0d699f39bde87e3) Merge branch 'canary' into fix/list-sessions-should-ignore-expired - [`a313d9c`](https://github.com/better-auth/better-auth/commit/a313d9cb443737556687521bb08e157542550401) Merge branch 'canary' into fix/list-sessions-should-ignore-expired - [`edc93dc`](https://github.com/better-auth/better-auth/commit/edc93dceef0d36f94e633958b0fcb087678680a5) Merge branch 'canary' into fix/list-sessions-should-ignore-expired - [`6e31aee`](https://github.com/better-auth/better-auth/commit/6e31aeef4292a24c1573611987c1b66f3e0ec768) Merge branch 'canary' into fix/list-sessions-should-ignore-expired - [`0d639a9`](https://github.com/better-auth/better-auth/commit/0d639a97cc8f78a3318788e4169dfab4a5553d25) Merge branch 'canary' into fix/list-sessions-should-ignore-expired - [`3149a1a`](https://github.com/better-auth/better-auth/commit/3149a1a5bec478eea33ab4a5cdbaa8ff3cfc28bc) Merge branch 'canary' into fix/list-sessions-should-ignore-expired - [`10e1b8f`](https://github.com/better-auth/better-auth/commit/10e1b8f5229c9820464d87478e9b803b1e09af9a) Merge branch 'canary' into fix/list-sessions-should-ignore-expired ### 📊 Changes **4 files changed** (+49 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/session.ts` (+1 -0) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+35 -3) 📝 `packages/better-auth/src/plugins/multi-session/index.ts` (+4 -2) 📝 `packages/core/src/types/context.ts` (+9 -1) </details> ### 📄 Description The `/list-sessions` endpoint and the `/multi-session/list-device-sessions` endpoint both return a list of active sessions. Both relying on the internal-adapter to fetch 100 sessions then using javascript to filter out expired ones. If there are over 100 inactive sessions than the returned result would be an empty array even if there are active sessions. This PR fixes this issue. Discord: https://discord.com/channels/1288403910284935179/1458337328916463688 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 23:28:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#32716