I am new to the world of Node.js, and have setup an app running on Heroku(free) using StrongLoop. I setup the heroku postgresql addon (free tier), and tried to add the datasource to StrongLoop's arc composer UI. This UI updates the server/datasources.json. When I try connecting to my datasource I get this error:
no pg_hba.conf entry for host "X.X.X.X", user "myUser", database "mydb", SSL off
I understand that the problem must be with setting up SSL on postgres. The closest StrongLoop documentation doesn't quite discuss this: https://strongloop.com/strongblog/postgresql-node-js-apis-loopback-connector/ ... Because I'm using StrongLoop rather than just straight Node.js, Heroku's documentation also left me lacking https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-node-js. I'm confused as to what I need to do exactly from here.
I have fairly simplistic newsfeed type JSON data that I manipulate with handlebars. So if it's an issue with being on the free tier, I'm open to other free suggestions with my setup. I appreciate your help.
Edit, datasources.json:
{"db":{"name":"db","connector":"memory"},
"mydb":{
"host":"myhost",
"port":####,
"url":"myamazonawsurl:####/mydbname",
"database":"mydbname",
"password":"mypw",
"name":"mydatasourcename",
"ssl":true,
"user":"myuser",
"connector":"postgresql"}}
More error details:
error: no pg_hba.conf entry for host "X.X.X.X", user "myuser", database "mydb", SSL off at
Connection.parseE (c:\myroot\node_modules\loopback-connector-postgresql\node_modules\pg\lib\connection.js:539:11) at
Connection.parseMessage (c:\myroot\node_modules\loopback-connector-postgresql\node_modules\pg\lib\connection.js:366:17) at
Socket.<anonymous> (c:\myroot\node_modules\loopback-connector-postgresql\node_modules\pg\lib\connection.js:105:22) at
Socket.emit (events.js:107:17) at readableAddChunk (_stream_readable.js:163:16) at
Socket.Readable.push (_stream_readable.js:126:10)
It should be "?ssl=true" not "?sslmode=require"
"devpostgresql": {
"url": "postgres://user:[email protected]:5432/dbname?ssl=true",
"name": "devpostgresql",
"connector": "postgresql"
}