Skip to content

Database: a query reconnects after a failed connect, so a thawed instance stops answering "Topology is closed" - #124

Merged
NiallJoeMaher merged 1 commit into
mainfrom
fix/db-reconnect-after-freeze
Oct 28, 2026
Merged

NiallJoeMaher merged 1 commit into
mainfrom
fix/db-reconnect-after-freeze

Conversation

@NiallJoeMaher

Copy link
Copy Markdown
Contributor

PostHog error tracking showed 19 server errors, all Failed to get session. Vercel's logs trace both 500s of the last two days (/inbox, /oauth/consent) to MongoTopologyClosedError: Topology is closed. One log line shows a connect that "timed out after 293681ms", which only happens when an instance is frozen mid-connect.

The driver keeps a topology that closed after a failed connect, and auto-connect only connects when there is no topology. keepConnected retried on a timer, but the timer froze along with the instance, so the first request after a thaw failed. reconnectWhenClosed drops a closed topology instead, and the next query connects again inside its own request. The test reproduces the prod error against the old client and passes against the new one.

Browser error tracking also drops Script error.: an in-app browser or extension raises it from another origin's script, with no message or stack.

Checks (Node 22): typecheck, lint, 501 unit tests, 56 e2e. pnpm design not run: no UI changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Per4f8yL5A7nL9frZVDJj7

…ance stops answering "Topology is closed"

On Vercel an instance frozen mid-connect thawed to a closed topology, and the retry timer that was meant to fix it
was frozen too: /inbox and /oauth/consent returned 500 ("Failed to get session") until the timer fired. Now a closed
topology is dropped and the next query connects again inside its own request.

Browser error tracking also stops sending "Script error.", which an in-app browser's or extension's script raises with
no message or stack.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Per4f8yL5A7nL9frZVDJj7
Signed-off-by: NiallJoeMaher <nialljoemaher@gmail.com>
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pluck Ready Ready Preview Oct 28, 2026 8:41am UTC

Request Review

@NiallJoeMaher
NiallJoeMaher merged commit 5419a33 into main Oct 28, 2026
5 checks passed
@NiallJoeMaher
NiallJoeMaher deleted the fix/db-reconnect-after-freeze branch October 28, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant