[COMPASS-4380] Parameter type validation crashes Compass Created: 03/Aug/20  Updated: 29/Oct/23  Resolved: 25/Sep/20

Status: Closed
Project: Compass
Component/s: Compass
Affects Version/s: 1.21.2, 1.22.0
Fix Version/s: 1.23.0

Type: Bug Priority: Major - P3
Reporter: Maurizio Casimirri Assignee: Maurizio Casimirri
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screenshot 2020-09-21 at 13.21.30.png    
Documentation Changes: Not Needed
Sprint: Iteration Maracuja

 Description   

When entering an invalid connection string the whole Compass crashes. This seems to happen if some of the url parameters have a wrong type (ie. I've added socketTimeoutMS twice and is considered to be an array instead of an integer)

This is the error i get the console:

  electron-localshortcut eventStamp: [object Object] no match +0ms
/usr/local/lib/node_modules/mongodb-connection-model/node_modules/ampersand-state/ampersand-state.js:214
                throw new TypeError('Property \'' + attr + '\' must be of type ' + def.type + '. Tried to set ' + newVal);
                ^
TypeError: Property 'socketTimeoutMS' must be of type number. Tried to set 300,100
    at child.set (/usr/local/lib/node_modules/mongodb-connection-model/node_modules/ampersand-state/ampersand-state.js:214:23)
    at child.Base (/usr/local/lib/node_modules/mongodb-connection-model/node_modules/ampersand-state/ampersand-state.js:39:21)
    at child [as constructor] (/usr/local/lib/node_modules/mongodb-connection-model/node_modules/ampersand-state/ampersand-state.js:785:27)
    at new child (/usr/local/lib/node_modules/mongodb-connection-model/node_modules/ampersand-state/ampersand-state.js:785:27)
    at /usr/local/lib/node_modules/mongodb-connection-model/lib/model.js:1170:27
    at /usr/local/lib/node_modules/mongodb-connection-model/node_modules/mongodb/lib/core/uri_parser.js:116:9
    at parseConnectionString (/usr/local/lib/node_modules/mongodb-connection-model/node_modules/mongodb/lib/core/uri_parser.js:685:3)
    at QueryReqWrap.callback (/usr/local/lib/node_modules/mongodb-connection-model/node_modules/mongodb/lib/core/uri_parser.js:110:7)
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:205:10)
(edited)



 Comments   
Comment by Githook User [ 25/Sep/20 ]

Author:

{'name': 'Maurizio Casimirri', 'email': 'maurizio.cas@gmail.com', 'username': 'mcasimir'}

Message: COMPASS-4380: handle exceptions in Connection.from (#2021)
Branch: master
https://github.com/mongodb-js/compass/commit/efb903911548669b3831bf542767863df37b55a4

Comment by Githook User [ 25/Sep/20 ]

Author:

{'name': 'mcasimir', 'email': 'maurizio.cas@gmail.com', 'username': 'mcasimir'}

Message: COMPASS-4380: handle exceptions in Connection.from
Branch: COMPASS-4380
https://github.com/mongodb-js/compass/commit/6be930270118e95d75160f7d6f8831d598d87880

Comment by Githook User [ 21/Sep/20 ]

Author:

{'name': 'Maurizio Casimirri', 'email': 'maurizio.cas@gmail.com', 'username': 'mcasimir'}

Message: COMPASS-4380: handle ampersand validation errors (#315)
Branch: master
https://github.com/mongodb-js/connection-model/commit/d12f53ce0578868a26e6287179fdbfe269a9108e

Comment by Githook User [ 21/Sep/20 ]

Author:

{'name': 'mcasimir', 'email': 'maurizio.cas@gmail.com', 'username': 'mcasimir'}

Message: COMPASS-4380: handle ampersand validation errors
Branch: COMPASS-4380
https://github.com/mongodb-js/connection-model/commit/b2ad2503c2178aebb1ba780762110048569eddc6

Generated at Wed Feb 07 22:36:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.