Issue in password auth while ingesting from MongoD...
# ingestion
w
Issue in password auth while ingesting from MongoDB: My yml file mongodb.yml has the connect_uri as following:
Copy code
connect_uri: "<mongodb://dbuser1>:xyz123#$$!us@192.168.1.100:27017/mongodbName?authSource=mongodbName"
The above mentioned username and password are correct, which I verified using Robo 3T client. When I try to ingest the metadata using the command
Copy code
datahub ingest -c ./mongodb.yml
It fails with the following auth error:
Copy code
all_credentials = {'mongodbName': MongoCredential ('SCRAM-SHA-1', 'mongodbName', 'dbuser1', 'xyz123#14911!us', None, <pymongo.auth._Cache object at 0x7ff8d7b91d00>, )
...
credentials = MongoCredential ('SCRAM-SHA-1', 'mongodbName', 'dbuser1', 'xyz123#14911!us', None, <pymongo.auth._Cache object at 0x7ff8d7b91d00>, )
...
...
OperationFailure: Authentication failed., full error: {'ok': 0.0, 'errmsg': 'Authentication failed.', 'code': 18, 'codeName': 'AuthenticationFailed', 'operationTime': Timestamp(1635941323, 2), '$clusterTime': {'clusterTime': Timestamp(1635941323, 2), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0}}}
Notice that the password provided by me in the yml file is: xyz123#$$!us ..while the password in the log statements are shown as: xyz123#14911!us Why is this happening? Is this a bug? Or am I missing something here? @big-carpet-38439 @miniature-tiger-96062
plus1 1
m
@witty-keyboard-20400 this is happening because we expand variables in the yaml file and the
$
sign makes us think you have a variable in there. The way to get around this is to escape the
$
so use \$ or else just use an env variable for the value in the recipe. e.g.
connect_uri: ā€œ<mongodb://host_name:$%7BMONGO_PASS%7D/|mongodb://host_name:${MONGO_PASS}/>ā€¦ā€
šŸ™‚ 1
āœ… 1
thank you 1
w
Thanks @mammoth-bear-12532 I escaped the $ symbols and it worked.