Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: "Double colon in host identifer"

I am trying to connect to a database that I have hosted at MLab. I am using the StrongLoop API. I've placed the config information for my hosted databases into my datasources.json and config.json files, but whenever I run the directory with npm start, I get throw new Error ('double colon in host identifier';) at api\node_modules\mongodb\lib\url_parser.js:45.

I have also made sure to install the loopback-connecter-mongodb npm package.

Here is a snippet of datasources.json (without the actual database details, of course):

{
  "db": {
    "name": "db",
    "connector": "mongodb",
    "host": "ds047355.mlab.com",
    "database": "dbtest",
    "username": "user",
    "password": "fakepassword",
    "port": 47355
  }
}

Here is the config.json file:

{
  "restApiRoot": "/api",
  "host": "ds047355.mlab.com",
  "port": 47355,
  "remoting": {
    "context": {
      "enableHttpContext": false
    },
    "rest": {
      "normalizeHttpPath": false,
      "xml": false
    },
    "json": {
      "strict": false,
      "limit": "100kb"
    },
    "urlencoded": {
      "extended": true,
      "limit": "100kb"
    },
    "cors": false,
    "errorHandler": {
      "disableStackTrace": false
    }
  },
  "legacyExplorer": false
}

Got any ideas?

like image 959
sleepy_daze Avatar asked Mar 24 '16 17:03

sleepy_daze


1 Answers

Make sure you don't have weird characters in it (e.g. @#$%^:,/.), I had some and got that error message. Changed the password to an alphanumeric one and works flawlessly.

like image 113
aluxian Avatar answered Oct 06 '22 07:10

aluxian