Loopback 4 unable to connect to Postgres 13 - postgresql

I am trying to connect with Postgres 13 from loopback 4 but its showing error
Cannot migrate database schema Error: Timeout in connecting after 5000 ms
at Timeout._onTimeout (/Users/mohammad/Work/prithu/prithuPlatform/node_modules/loopback-datasource-juggler/lib/datasource.js:2654:10)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
I tried connecting with pgadmin and its connecting fine and I also tried connecting it with express and its also connecting. It was connecting with earlier system but after changing system and installing Postgres 13 it's not working.
Here is the snapshot of app-db.datasource.config.json
{
"name": "app_db",
"connector": "postgresql",
"debug": true,
"host": "localhost",
"port": 5432,
"user": "adminuser",
"password": "password123",
"database": "testdb",
"ssl": false
}

Finally I figured out what was the problem. It was because I was using node 14. There was no problem with the database. I then install the node 12 and it's working now.

I faced the same issue.
I was putting the wrong password for postgres user in datasource.config, check that.
{
"name": "app_db",
"connector": "postgresql",
"debug": true,
"host": "localhost",
"port": 5432,
"user": "adminuser",
"password": "password123", (maybe this password is wrong)
"database": "testdb",
"ssl": false
}

Related

How do I connect a sequelize ORM with express to ElephantSQL postgres instance?

This is my configuration in express config.json file
{
"development": {
"username": "elcaaklk",
"password": "oliBfN1v8h7-JPE3_UN3LJeT3-pf10aJ",
"database":"elcaaklk",
"host": "postgres://elcaaklk:oliBfN1v8h7-JPE3_UN3LJeT3-pf10aL#drona.db.elephantsql.com/elcaaklk",
"dialect": "postgres"
}
This is the error I am getting when I type sequelize db:create
getaddrinfo EAI_FAIL postgres://elcaaklk:oliBfN1v8h7-JPE3_UN3LJeT3-pf10aL#drona.db.elephantsql.com/elcaaklk
The database connections work fine and the pg client is able to connect to the database.
This is what I use:
"development": {
"use_env_variable": "DATABASE_URL",
"logging": false,
"dialect": "postgres",
"dialectOptions": {
"ssl": {
"require": true,
"rejectUnauthorized": false
}
}
}
And then I set the environment variable DATABASE_URL to the quoted postgres:// URI
You could also use your method but then you have to set "host" to equal just the host part of the URI (drona.db.elephantsql.com)

Issues with FTPS connection on port 990 in VScode

I'm trying to setup my FTP in VSCode using the sftp extension but I can't get it to connect, it says it's timing out every time. The issue is that my SFTP config from sublime text has always worked on this specific server (ftps connection using port 990). Never had a single issue.
The config that has been working on sublime text:
"type": "ftps",
"save_before_upload": true,
"upload_on_save": true,
"host": "ftpweb.user.srv",
"user": "ftpweb.user.srv|user1",
"password": "redacted",
"port": "990",
"remote_path": "/",
"connect_timeout": 5,
"keepalive": 120,
"ftp_passive_mode": true,
"ftp_obey_passive_host": true,
"allow_config_upload": true,
new config for VScode that is timing out:
{
"name": "test",
"host": "ftpweb.user.srv",
"protocol": "ftp",
"secure": true,
"secureOptions": {
"rejectUnauthorized": false
},
"port": 990,
"username": "ftpweb.user.srv|user1",
"password": "redacted",
"remotepath": "/",
"uploadOnSave": true
}
What am I missing in VScode? I know it doesn't truly support ftps but I thought there would be a workaround using ftp, I just can't seem to find any loophole here. Has anyone been able to connect to a FTPS server on port 990 in VSCode?

Strapi EADDRNOTAVAIL error while deploying on Dokku

I am trying to deploy Strapi on a Dokku instance on a Digital Ocean droplet. I originally ran into some issues connecting to the mongo database, but after some trial and error and a lot of review of these docs and this issue, I was able to get it to stop complaining about the mongo connection. Here was my final config/environments/production/database.json
{
"defaultConnection": "default",
"connections": {
"default": {
"connector": "mongoose",
"settings": {
"client": "mongo",
"uri": "${process.env.MONGO_URL}",
"database": "${process.env.DATABASE_NAME}",
"username": "${process.env.DATABASE_USERNAME}",
"password": "${process.env.DATABASE_PASSWORD}",
"port": "${process.env.DATABASE_PORT || 27017}"
},
"options": {
"authenticationDatabase": "${process.env.DATABASE_AUTHENTICATION_DATABASE || ''}",
"useUnifiedTopology": "${process.env.USE_UNIFIED_TOPOLOGY || false}",
"ssl": "${process.env.DATABASE_SSL || false}"
}
}
}
}
Here is my config/environments/production/server.json
{
"host": "${process.env.HOST || '0.0.0.0'}",
"port": "${process.env.PORT || 1337}",
"production": true,
"proxy": {
"enabled": false
},
"cron": {
"enabled": false
},
"admin": {
"autoOpen": false
}
}
I believe the original issue was that I was accidentally using the PORT variable for the database instead of the DATABASE_PORT variable.
However, now that I have that worked out I am getting this error:
error Error: listen EADDRNOTAVAIL: address not available <my-host-ip>:5000
I thought maybe there was some wrong port being cached somewhere, but regardless of what I do, I can't seem to get it to work. Do I need to enable ssl? and then add a letsencrypt cert to my domain? am i using the wrong ports? set a proxy in the server.json?
PS. I am using Dokku Mongo. Didn't think that would be an issue considering the dynos don't go to sleep like they would on heroku. Is that an incorrect assumption?
Also, there are other apps running on the droplet. Maybe a proxy problem?

Hyperledger Explorer Error 12 UNIMPLEMENTED: service protos.Endorser

I am trying to run the Hypeledger Explorer for my blockchain network. I have followed the instructions almost word for word using the Hyperldger Explorer
But anytime I do the final call: ./start.sh --- I get a litany of errors
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 12 UNIMPLEMENTED: unknown service protos.Endorser
at new createStatusError (/home/ubuntu/bludev/blockchain-explorer/node_modules/grpc/src/client.js:64:15)
at /home/ubuntu/bludev/blockchain-explorer/node_modules/grpc/src/client.js:583:15
error: [Client.js]: Failed Installed Chaincodes Query. Error: Error: 12 UNIMPLEMENTED: unknown service protos.Endorser
at new createStatusError (/home/ubuntu/bludev/blockchain-explorer/node_modules/grpc/src/client.js:64:15)
at /home/ubuntu/bludev/blockchain-explorer/node_modules/grpc/src/client.js:583:15
...
And so on. For more info I am using
nodejs 6.9 and PostgreSQL 9.5. This is the way my config.json file looks:
{
"network-config": {
"org1": {
"name": "peerOrg1",
"mspid": "Org1MSP",
"peer1": {
"requests": "grpc://127.0.0.1:7051",
"events": "grpc://127.0.0.1:7053",
"server-hostname": "peer0.org1.example.com",
"tls_cacerts": "/home/ubuntu/bludev/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
},
"admin": {
"key": "/home/ubuntu/bludev/hlcomposer/fabric-dev-servers/fabric-scripts/hlfv1/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/keystore",
"cert": "/home/ubuntu/bludev/hlcomposer/fabric-dev-servers/fabric-scripts/hlfv1/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/signcerts"
}
}
},
"host": "localhost",
"port": "3000",
"channel": "mychannel",
"keyValueStore": "/tmp/fabric-client-kvs",
"eventWaitTime": "30000",
"pg": {
"host": "12.109.99.233",
"port": "3000",
"database": "fabricexplorer",
"username": "postgres",
"passwd": "password1"
}}
The problem is your hyperledger network does not have any endorser in network.
try first-network sample from official fabric-samples folder, rebuild the explorer and then try again.

Loopback: Connect with xampp server using Windows

I am trying to connect to my xampp server but it is not being connected.
Here is my datasources.json
{
"db": {
"name": "db",
"connector": "memory"
}
"test": {
"host": "localhost",
"port": 3306,
"database": "test",
"name": "test",
"debug": false,
"connector": "mysql",
"socketPath" : "C:/xampp/mysql/bin/my.ini"
}
}
I do not know that my socket path is having an issue.
Error:
Error:connect ENOTSOCK C:/xampp/mysql/bin/my.ini
In your config file socketpath should be given socket file that is .sock extension commonly
C:/xampp/mysql/mysql.sock
You are not gaving the password and username of mysql database
"test": {
"host": "127.0.0.1",
"port": 3306,
"database": "mysqltest",
"password": "", ///password
"name": "test",
"connector": "mysql",
"user": "root" ///username
}