Connection Failure Message: exception: login failed and U_STRINGPREP_PROHIBITED_ERROR
Symptom
An error is reported when you run the following command to connect to a DDS instance:
./mongo "mongodb://rwuser:xxxxxx@192.168.0.45:8635,192.168.0.96:8635/test?authSource=admin&replicaSet=replica"
Error message:
MongoDB shell version v4.0.3 connecting to: mongodb://192.168.0.45:8635,192.168.0.96:8635/test?authSource=admin&replicaSet=replica 2021-11-05T05:52:53.717+0000 I NETWORK [js] Starting new replica set monitor for replica/192.168.0.45:8635,192.168.0.96:8635 2021-11-05T05:52:53.718+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to 192.168.0.45:8635 (1 connections now open to 192.168.0.45:8635 with a 5 second timeout) 2021-11-05T05:52:53.718+0000 I NETWORK [js] Successfully connected to 192.168.0.96:8635 (1 connections now open to 192.168.0.96:8635 with a 5 second timeout) Implicit session: session { "id" : UUID("5945d2a5-8275-4e3c-b06f-632f062a2ead") } MongoDB server version: 4.0.3 2021-11-05T05:52:53.722+0000 I NETWORK [js] Marking host 192.168.0.96:8635 as failed :: caused by :: Location50692: can't authenticate against replica set node 192.168.0.96:8635 :: caused by :: Error preflighting normalization: U_STRINGPREP_PROHIBITED_ERROR 2021-11-05T05:52:53.722+0000 I NETWORK [js] Successfully connected to 192.168.0.45:8635 (1 connections now open to 192.168.0.45:8635 with a 0 second timeout) 2021-11-05T05:52:53.723+0000 I NETWORK [js] Marking host 192.168.0.45:8635 as failed :: caused by :: Location50692: can't authenticate against replica set node 192.168.0.45:8635 :: caused by :: Error preflighting normalization: U_STRINGPREP_PROHIBITED_ERROR 2021-11-05T05:52:53.724+0000 I NETWORK [js] Marking host 192.168.0.96:8635 as failed :: caused by :: Location50692: can't authenticate against replica set node 192.168.0.96:8635 :: caused by :: Error preflighting normalization: U_STRINGPREP_PROHIBITED_ERROR 2021-11-05T05:52:53.725+0000 I NETWORK [js] Marking host 192.168.0.45:8635 as failed :: caused by :: Location50692: can't authenticate against replica set node 192.168.0.45:8635 :: caused by :: Error preflighting normalization: U_STRINGPREP_PROHIBITED_ERROR 2021-11-05T05:52:53.725+0000 E QUERY [js] Error: can't authenticate against replica set node 192.168.0.45:8635 :: caused by :: Error preflighting normalization: U_STRINGPREP_PROHIBITED_ERROR : DB.prototype._authOrThrow@src/mongo/shell/db.js:1685:20 @(auth):6:1 @(auth):1:2 exception: login failed
Possible Cause
The instance password is incorrect.
Fault Locating
- Check whether the DDS instance password contains the at sign (@), percent sign ( %), and exclamation mark (!). If yes, escape them.
- DDS instances support the following special characters that require escaping ~!@#$ %^ *-_=+?. %@
Solution
Method 1: Change the password of the DDS instance. The new password cannot contain the at sign (@), percent sign ( %), and exclamation mark (!).
Method 2: When connecting to a DDS instance, escape the at sign (@), percent sign ( %), and exclamation mark (!) and replace them with hexadecimal URL codes (ASCII codes) %40, %25, and %21.
For example, if the password is ****@ %***!, the corresponding URL code is **** %40%25*** %21.
Background Information
The at sign (@), percent sign ( %), and exclamation mark (!) are processed as special characters when you connect to a DDS instance. If these characters are used, they must be escaped when you use the HA connection address to connect to the DDS instance, otherwise, the password cannot be parsed.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.