fix: MongoDB waitForReady falls back to TCP when auth rejects mongosh#160
fix: MongoDB waitForReady falls back to TCP when auth rejects mongosh#160robertjbass merged 1 commit intomainfrom
Conversation
📝 WalkthroughWalkthroughVersion 0.47.13 adds a fallback recovery mechanism to MongoDB's readiness probe. When mongosh authentication fails, the health check now attempts a TCP port availability check instead of waiting for retry, improving readiness detection for auth-enabled MongoDB instances. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@engines/mongodb/index.ts`:
- Around line 596-601: The catch currently treats all mongosh failures as auth
and falls back to TCP; change it to capture the thrown error and only perform
the TCP fallback when the error message or code matches auth-related signatures
(e.g., /auth|authentication|not authorized|Unauthorized/i or known mongosh auth
exit codes); for any other error rethrow or continue the health retry loop so we
don't report ready when mongod is unhealthy. Locate the try/catch around the
mongosh health check and update it to inspect the caught error before calling
this.checkPortOpen(port) (referenced symbol: checkPortOpen) and only return true
on TCP fallback when the error matches the auth-specific checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 38779bc2-60ab-44c8-a7a0-5920602c170b
📒 Files selected for processing (3)
CHANGELOG.mdengines/mongodb/index.tspackage.json
Summary by CodeRabbit
Bug Fixes
Chores