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

Unable to connect to Replica Set or Sharded Cluster #663

Open
jukkakilponen opened this issue Apr 1, 2022 · 9 comments · May be fixed by #666
Open

Unable to connect to Replica Set or Sharded Cluster #663

jukkakilponen opened this issue Apr 1, 2022 · 9 comments · May be fixed by #666
Assignees
Labels
bug v6.x Affects v6.x

Comments

@jukkakilponen
Copy link

Steps to reproduce

Have a mongodb connection string with multiple hosts and ports (Replica Set or Sharded Cluster) as in https://www.mongodb.com/docs/manual/reference/connection-string/.
For example mongodb://mongos0.example.com:27017,mongos1.example.com:27017,mongos2.example.com:27017

Current Behavior

Cannot start the application. TypeError [ERR_INVALID_URL]: Invalid URL: mongodb://mongos0.example.com:27017,mongos1.example.com:27017,mongos2.example.com:27017

Expected Behavior

Should connect to database.

Additional information

Tested with 6.2.0.
The problem seems to be the use of nodejs URL to parse the connection string. The URL does not support multiple hosts with port numbers.
See whatwg/url#398.
Problem introduced in commit 1d8a84b.

Related Issues

@dhmlau
Copy link
Member

dhmlau commented Apr 1, 2022

@jukkakilponen, thanks for reporting. Would you like to raise a PR?

@jaishirole
Copy link

@dhmlau
This bug should have a regression label. Our application is broken since upgrade of mongodb connector to 6.x! There have been security vulnerability fixes in 6.x, which we need but not at the expense of regressed behavior.
If no one is looking into, I'll take out some time over weekend to fix this.

@jaishirole
Copy link

@dhmlau @achrinza
Can you assign this issue to me? I've coded up a fix, working on unit tests and as soon as done, will raise a PR.

@jaishirole jaishirole linked a pull request Apr 19, 2022 that will close this issue
5 tasks
@achrinza achrinza moved this from Icebox to Current/Backlog in LoopBack Common Project Board May 10, 2022
jaishirole added a commit to jaishirole/loopback-connector-mongodb that referenced this issue May 31, 2022
@manarhusrieh
Copy link

Any updates on this issue since we are also facing the same issue and we are not able to use SRV in our current deployment architecture

@jaishirole
Copy link

@manarhusrieh My PR has been awaiting merge. @achrinza could you please confirm who would be reviewing and merging the PR?

@manarhusrieh
Copy link

@jaishirole I think you will need to resolve conflicts in your PR and rebase again on the latest version

@haidanghoang
Copy link

Hi guys,
Any update on this issue?

@NurdinDev
Copy link

I think the PR is close to being merged, but it needs some conflicts resolved by @jaishirole and final approval.

@gian1200
Copy link

It's worth mentioning that 6.1.0 do not have this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v6.x Affects v6.x
Projects
Status: Current/Backlog
Development

Successfully merging a pull request may close this issue.

8 participants