mingo-app / mingo

Found a bug? have a FR ?
60 stars 2 forks source link

[Bug] SSH connection not working - mongodb+srv URI port number #602

Open dimarixsus opened 1 year ago

dimarixsus commented 1 year ago

Describe the bug When testing a connection through SSH, is saying "MongoParseError: mongodb+srv URI cannot have port number". In the attached screenshot I understand I'm not putting anything strange. In fact, this same configuration works in Compass and in NoSQLBooster for MongoDB.

If you try to remove the +srv and do it with replica set configuration, it gives me another error. But let's start with this one at least.

Screenshots CleanShot 2023-07-13 at 10 22 23@2x

Desktop (please complete the following information):

dimarixsus commented 1 year ago

@achtan @tothradoslav did you have a chance to look into this?

Thanks

Icaruk commented 1 year ago

Same problem here :(

tothradoslav commented 1 year ago

I'm testing this on my own atlas serverless connection and it gives me the same error when I add port to my connection uri. It seems like the port number is really not allowed in such cases. Two questions:

  1. what is the connection you are trying to connect to? I'd like to be able to reproduce this somehow
  2. have you tried simply removing the port and connecting without it?
dimarixsus commented 1 year ago

I'm testing this on my own atlas serverless connection and it gives me the same error when I add port to my connection uri. It seems like the port number is really not allowed in such cases. Two questions:

  1. what is the connection you are trying to connect to? I'd like to be able to reproduce this somehow
  2. have you tried simply removing the port and connecting without it?

Hi @tothradoslav !

  1. The connection I'm connecting is a regular MongoDB Atlas URI, which I copied and pasted from MongoDB Compass which works. I can't provide you the full URI, sorry. We have this connection protected through AWS Bastion, which is why we have to connect to it through SSH
  2. When I remove the "port" part from the SSH connection, the UI marks the field as required in red.

I hope this helps, thanks

tothradoslav commented 1 year ago

I'm creating a simple mongodb Atlas URI and it never contains a port, it always ends with ".mongodb.net/". Where could I create such a connection that uses +srv and a port number so I can test it out?

dimarixsus commented 1 year ago

I'm creating a simple mongodb Atlas URI and it never contains a port, it always ends with ".mongodb.net/". Where could I create such a connection that uses +srv and a port number so I can test it out?

I think that the "port" part relates to the SSH connection and not to the database connection :/

tothradoslav commented 1 year ago

shouldn't SSH be a separate config from mongo uri? I'm trying to work my head around this as it doens't make much sense even though it works in compass...

dimarixsus commented 1 year ago

shouldn't SSH be a separate config from mongo uri? I'm trying to work my head around this as it doens't make much sense even though it works in compass...

Oh maybe I'm not understanding completely everything. But I mean, from the screenshot I provided in the issue description, we can see I have the database connection and I have the SSH connection.

About your question: I understand that the SSH it is a separate config from the database.

This is how it looks in Compass

CleanShot 2023-09-19 at 18 32 02@2x

And in the Authentication tab I have the username and password for SSH

Icaruk commented 1 year ago

My URI: mongodb://my_user:PASSWORDPLACEHOLDER@localhost:27017/?authMechanism=DEFAULT&authSource=admin I can't delete 27017 because when click "save" it appears again.

SSH Host (not real): 12.12.12.12

Port (not real): 1234

Username: my_username

Auth type: Private key

This works on compass.

EDIT: I'm having a connection error:

Unable to connect to this connection:
MongoServerSelectionError: Server selection timed out after 5000 ms
tothradoslav commented 1 year ago

@dimarixsus the actual URI does not contain any port, the SSH config appears in Mingo after you check the checkbox:

Screenshot 2023-09-20 at 21 16 53

This is where you enter the SSH configuration as in compass screenshot.

tothradoslav commented 1 year ago

@Icaruk do you have the port in the original URI you are trying to use? If not, we have a check to add it for some cases it's necessary, but we could disable it so you can use it without the port number, too.

dimarixsus commented 1 year ago

@dimarixsus the actual URI does not contain any port, the SSH config appears in Mingo after you check the checkbox:

Screenshot 2023-09-20 at 21 16 53

This is where you enter the SSH configuration as in compass screenshot.

Sorry, I can't properly understand you reply. I'm aware the URI does not contain any port and also I'm aware the SSH config appears when you hit the checkbox. All you said I understand I'm pointing it out in the screenshot I placed in the issue description.

Ty

Icaruk commented 1 year ago

@Icaruk do you have the port in the original URI you are trying to use? If not, we have a check to add it for some cases it's necessary, but we could disable it so you can use it without the port number, too.

My URI: mongodb://my_user:PASSWORDPLACEHOLDER@localhost:27017/?authMechanism=DEFAULT&authSource=admin

If I try to remove 27017 from it, when I click "Save changes" or "Test connection", 27017 is appended to localhost.

tothradoslav commented 1 year ago

@Icaruk we have removed the "auto-append-port" feature in next release.

@dimarixsus What I mean is that even when I selected Proxy / SSH, the URI does not contain the port, only port setting is for the SSH config which you have to enter in the "Port:" field for SSH as in screenshot.

Icaruk commented 1 year ago

@Icaruk we have removed the "auto-append-port" feature in next release.

@dimarixsus What I mean is that even when I selected Proxy / SSH, the URI does not contain the port, only port setting is for the SSH config which you have to enter in the "Port:" field for SSH as in screenshot.

Thanks, anyways my URI works in compass, but not here :/

tothradoslav commented 1 year ago

Maybe they actually remove it in the background manually. The error comes from mongo driver itself...

Icaruk commented 1 year ago

Maybe they actually remove it in the background manually. The error comes from mongo driver itself...

I'll come back after the release!

dimarixsus commented 1 year ago

@Icaruk we have removed the "auto-append-port" feature in next release.

@dimarixsus What I mean is that even when I selected Proxy / SSH, the URI does not contain the port, only port setting is for the SSH config which you have to enter in the "Port:" field for SSH as in screenshot.

Oh, I understand now. In the screenshot there is a 27017. I just tested it without that port number and same problem happens :(

CleanShot 2023-09-22 at 10 39 07@2x

Icaruk commented 1 year ago

Problem persists, please help!

lb12 commented 1 year ago

I am getting an error too! I don't know why, but the URI is the same as I have it in Mongo compass and the rest of credentials seems to be equals too...

This is the error that I obtain when I click on "Test connection" button.

image

Please, fix this, I am getting mad using Compass in Production env instead of Mingo 😵‍💫

Thanks!

Icaruk commented 1 year ago

More info here:

image

The URI works fine in Compass

Detodation-shakers commented 1 year ago

Same problem!! Does anyone have a workaround for this? Really frustrating!

edugargar commented 1 year ago

It would be really helpful if we could have any advance on this issue =)

andrespervil commented 1 year ago

Experiencing the same issue here. Any updates or workarounds would be greatly appreciated! 😊