-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.6.3
-
Component/s: Shell
-
None
Problem Description
Some of the query parameters in a connection string allow a file path to be specified, e.g. the tlsCAFile option, that will be resolved to the file contents before connecting. However, using an absolute path on Windows will result in an error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of Object
It seems that the error is caused by the parseQueryStringItemValue method (https://github.com/mongodb/node-mongodb-native/blob/master/src/connection_string.ts#L154). It checks for the presence of a : in the parameter value and if so converts it into an object with key-values by splitting. However, an absolute path on windows will always start with <drive letter>:\... so the : will always be present.
This at least affects v4 - not tested for 3.x.
Steps to Reproduce
Try connecting to a MongoDB node passing the tlsCAFile query parameter in the connection string on Windows with a valid absolute path.
Expected Results
The connection is created and works/fails according to the CA provided.
Actual Results
No connection is created but an error is thrown while trying to execute fs.readFileSync when resolving the tlsCAFile.
- is depended on by
-
MONGOSH-418 Add connectivity tests for mlaunch-supported scenarios
- Closed