digifi-io / loan-origination-system

DigiFi Loan Origination System
Apache License 2.0
9 stars 12 forks source link

Error: Username containing an unescaped at-sign #98

Open shalakolee opened 4 years ago

shalakolee commented 4 years ago

in the .env file

DB_CONFIG={"settings": {"name": "Decision Engine Service", "application": { "environment": "development" }}, "configuration":{"type": "db", "db":"mongoose", "options":{"url":"YOUR_MONGODB_CONFIGURATION_STRING/configuration_local", "mongoose_options":{"replset": { "rs_name": "YOUR_MONGODB_REPLICA_SET_NAME" },"server":{ "keepAlive": 1, "connectTimeoutMS": 30000, "socketTimeoutMS": 30000 }} }}}

there is nowhere that defines what the

YOUR_MONGODB_CONFIGURATION_STRING/configuration_local option should be, so I am assuming that it is the connection string, so i made mine

DB_CONFIG={"settings": {"name": "Decision Engine Service", "application": { "environment": "development" }}, "configuration":{"type": "db", "db":"mongoose", "options":{"url":"mongodb+srv://username:password@loscluster-*****.azure.mongodb.net/configuration_local", "mongoose_options":{"replset": { "rs_name": "LOSCluster-shard-0" },"server":{ "keepAlive": 1, "connectTimeoutMS": 30000, "socketTimeoutMS": 30000 }} }}}

Note: the **** is to hide the url

Now I am getting this error:

> decision-engine-service@1.4.1 start /var/www/html/loan-origination-system
> node index.js --e "development"

the server/replset/mongos/db options are deprecated, all their options are supported at the top level of the options object [poolSize,ssl,sslValidate,sslCA,sslCert,sslKey,sslPass,sslCRL,autoReconnect,noDelay,keepAlive,keepAliveInitialDelay,connectTimeoutMS,family,socketTimeoutMS,reconnectTries,reconnectInterval,ha,haInterval,replicaSet,secondaryAcceptableLatencyMS,acceptableLatencyMS,connectWithNoPrimary,authSource,w,wtimeout,j,forceServerObjectId,serializeFunctions,ignoreUndefined,raw,bufferMaxEntries,readPreference,pkFactory,promiseLibrary,readConcern,maxStalenessSeconds,loggerLevel,logger,promoteValues,promoteBuffers,promoteLongs,domainsEnabled,checkServerIdentity,validateOptions,appname,auth,user,password,authMechanism,compression,fsync,readPreferenceTags,numberOfRetries,auto_reconnect,minSize,monitorCommands,retryWrites,retryReads,useNewUrlParser,useUnifiedTopology,serverSelectionTimeoutMS,useRecoveryToken,autoEncryption,driverInfo,tls,tlsInsecure,tlsinsecure,tlsAllowInvalidCertificates,tlsAllowInvalidHostnames,tlsCAFile,tlsCertificateFile,tlsCertificateKeyFile,tlsCertificateKeyFilePassword,minHeartbeatFrequencyMS,heartbeatFrequencyMS,waitQueueTimeoutMS]
the server/replset/mongos/db options are deprecated, all their options are supported at the top level of the options object [poolSize,ssl,sslValidate,sslCA,sslCert,sslKey,sslPass,sslCRL,autoReconnect,noDelay,keepAlive,keepAliveInitialDelay,connectTimeoutMS,family,socketTimeoutMS,reconnectTries,reconnectInterval,ha,haInterval,replicaSet,secondaryAcceptableLatencyMS,acceptableLatencyMS,connectWithNoPrimary,authSource,w,wtimeout,j,forceServerObjectId,serializeFunctions,ignoreUndefined,raw,bufferMaxEntries,readPreference,pkFactory,promiseLibrary,readConcern,maxStalenessSeconds,loggerLevel,logger,promoteValues,promoteBuffers,promoteLongs,domainsEnabled,checkServerIdentity,validateOptions,appname,auth,user,password,authMechanism,compression,fsync,readPreferenceTags,numberOfRetries,auto_reconnect,minSize,monitorCommands,retryWrites,retryReads,useNewUrlParser,useUnifiedTopology,serverSelectionTimeoutMS,useRecoveryToken,autoEncryption,driverInfo,tls,tlsInsecure,tlsinsecure,tlsAllowInvalidCertificates,tlsAllowInvalidHostnames,tlsCAFile,tlsCertificateFile,tlsCertificateKeyFile,tlsCertificateKeyFilePassword,minHeartbeatFrequencyMS,heartbeatFrequencyMS,waitQueueTimeoutMS]
(node:73138) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
Mongoose default connection disconnected
Could not initialize Periodic
Error: Username containing an unescaped at-sign
    at parseConnectionString (/var/www/html/loan-origination-system/node_modules/mongodb/lib/url_parser.js:187:13)
    at parseHandler (/var/www/html/loan-origination-system/node_modules/mongodb/lib/url_parser.js:130:14)
    at QueryReqWrap.callback (/var/www/html/loan-origination-system/node_modules/mongodb/lib/url_parser.js:114:7)
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:198:10)
(node:73138) UnhandledPromiseRejectionWarning: Error: Username containing an unescaped at-sign
    at parseConnectionString (/var/www/html/loan-origination-system/node_modules/mongodb/lib/url_parser.js:187:13)
    at parseHandler (/var/www/html/loan-origination-system/node_modules/mongodb/lib/url_parser.js:130:14)
    at QueryReqWrap.callback (/var/www/html/loan-origination-system/node_modules/mongodb/lib/url_parser.js:114:7)
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:198:10)
(node:73138) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:73138) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have tried to unescape the json, but still get the same error

shalakolee commented 4 years ago

UPDATE: I fixed this by removing the @ symbol from my password.... perhaps change

 /node_modules/mongodb/lib/url_parser.js

to allow for @ symbols in the username or password

or at least update your documentation to show that you cannot have an @ symbol in the user/pass so people don't waste hours trying to figure this one out