Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DirectConnection Option in MongoDB SDK #15968

Merged
merged 4 commits into from
Jun 14, 2023

Conversation

tianzhu007
Copy link
Contributor

We currently have a ReplicaSetNoPrimary error caused by MongoServerSelectionError: connection timed out\n
{"reason"=>{"type"=>"ReplicaSetNoPrimary", "servers"=>{}, "stale"=>"REDACTED", "compatible"=>"REDACTED", "heartbeatFrequencyMS"=>"REDACTED", "localThresholdMS"=>"REDACTED", "setName"=>"REDACTED", "maxElectionId"=>nil, "maxSetVersion"=>"REDACTED", "commonWireVersion"=>"REDACTED", "logicalSessionTimeoutMinutes"=>nil}, "name"=>"MongoServerSelectionError", "message"=>"connection timed out", "stack"=>"MongoServerSelectionError: connection timed out\n at Timeout._onTimeout (/usr/src/server/bundle/alfred/www.js:126365:34)\n at listOnTimeout (node:internal/timers:559:17)\n at processTimers (node:internal/timers:502:7)"}

From: https://stackoverflow.com/questions/59162342/mongodb-connection-error-mongotimeouterror-server-selection-timed-out-after-30, we can fix it by enabling directConnection flag as true.

Here is the definition for directConnection: https://mongodb.github.io/node-mongodb-native/4.14/interfaces/MongoClientOptions.html#directConnection

@tianzhu007 tianzhu007 requested a review from a team as a code owner June 13, 2023 07:46
@github-actions github-actions bot added area: server Server related issues (routerlicious) base: main PRs targeted against main branch labels Jun 13, 2023
@zhangxin511 zhangxin511 self-requested a review June 13, 2023 18:30
@tianzhu007 tianzhu007 merged commit 58c6203 into microsoft:main Jun 14, 2023
connorskees pushed a commit to connorskees/FluidFramework that referenced this pull request Jul 19, 2023
We currently have a ReplicaSetNoPrimary error caused by
MongoServerSelectionError: connection timed out\n
{"reason"=>{"type"=>"ReplicaSetNoPrimary", "servers"=>{},
"stale"=>"REDACTED", "compatible"=>"REDACTED",
"heartbeatFrequencyMS"=>"REDACTED", "localThresholdMS"=>"REDACTED",
"setName"=>"REDACTED", "maxElectionId"=>nil,
"maxSetVersion"=>"REDACTED", "commonWireVersion"=>"REDACTED",
"logicalSessionTimeoutMinutes"=>nil},
"name"=>"MongoServerSelectionError", "message"=>"connection timed out",
"stack"=>"MongoServerSelectionError: connection timed out\n at
Timeout._onTimeout (/usr/src/server/bundle/alfred/www.js:126365:34)\n at
listOnTimeout (node:internal/timers:559:17)\n at processTimers
(node:internal/timers:502:7)"}

From:
https://stackoverflow.com/questions/59162342/mongodb-connection-error-mongotimeouterror-server-selection-timed-out-after-30,
we can fix it by enabling directConnection flag as true.

Here is the definition for directConnection:
https://mongodb.github.io/node-mongodb-native/4.14/interfaces/MongoClientOptions.html#directConnection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: server Server related issues (routerlicious) base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants