Error: Timeout in connecting after 5000 ms
at Timeout._onTimeout (/home/manthan/Desktop/temp/temp/node_modules/loopback-datasource-juggler/lib/datasource.js:2654:10)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
But I also made a js file and tried to make connection there to check any issue with postgres ,

Package.json ->
`
{
"name": "temp",
"version": "1.0.0",
"description": "temp",
"keywords": [
"loopback-application",
"loopback"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=10"
},
"scripts": {
"build": "npm run clean && lb-tsc",
"build:watch": "lb-tsc --watch",
"lint": "npm run prettier:check && npm run eslint",
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
"prettier:cli": "lb-prettier \"/.ts\" \"/.js\"",
"prettier:check": "npm run prettier:cli -- -l",
"prettier:fix": "npm run prettier:cli -- --write",
"eslint": "lb-eslint --report-unused-disable-directives .",
"eslint:fix": "npm run eslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha --allow-console-logs \"dist/__tests__\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/*/.js && npm run posttest",
"docker:build": "docker build -t temp .",
"docker:run": "docker run -p 3000:3000 -d temp",
"migrate": "node ./dist/migrate",
"prestart": "npm run build",
"start": "node -r source-map-support/register .",
"clean": "lb-clean dist .tsbuildinfo .eslintcache"
},
"repository": {
"type": "git"
},
"author": "",
"license": "",
"files": [
"README.md",
"dist",
"src",
"!/__tests__"
],
"dependencies": {
"@loopback/boot": "^2.3.1",
"@loopback/context": "^3.8.1",
"@loopback/core": "^2.7.0",
"@loopback/openapi-v3": "^3.4.1",
"@loopback/repository": "^2.5.1",
"@loopback/rest": "^5.0.1",
"@loopback/rest-explorer": "^2.2.2",
"@loopback/service-proxy": "^2.3.0",
"@types/pg": "^7.14.3",
"loopback-connector-postgresql": "^3.9.1",
"tslib": "^1.10.0"
},
"devDependencies": {
"@loopback/build": "^5.4.1",
"@loopback/eslint-config": "^7.0.1",
"@loopback/testlab": "^3.1.5",
"@types/node": "^10.17.24",
"eslint": "^7.0.0",
"pg": "^8.2.1",
"source-map-support": "^0.5.19",
"typescript": "~3.9.3"
}
}
`

Can you try localhost at host and try
yes i tried but got same error

Please check
npm run clean
npm run build
npm run migrates
helps you ?
also shot a try to rm-r node_modules than npm install
npm run clean , npm run build is working well , and making dist , but npm run migrate gives same error, tried 3rd point also , but problem persists
Hi, I got similar issue with postgresql and loopback4. I created the datasource with lb4 datasource command, then repository, controller and when I want to test it, I got a time out error. I've already done npm run clean - npm run build, deleted the node_modules folder and run npm install but I got same error. Could some one tell me what am I doing wrong?
By the way I'm following the todo tutorial of loopback page with some modifications.

package.json
{
"name": "identity_provider",
"version": "1.0.0",
"description": "Backend for aunthentication and authorization",
"keywords": [
"loopback-application",
"loopback"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=10"
},
"scripts": {
"build": "lb-tsc",
"build:watch": "lb-tsc --watch",
"lint": "npm run prettier:check && npm run eslint",
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
"prettier:cli": "lb-prettier \"/.ts\" \"/.js\"",
"prettier:check": "npm run prettier:cli -- -l",
"prettier:fix": "npm run prettier:cli -- --write",
"eslint": "lb-eslint --report-unused-disable-directives .",
"eslint:fix": "npm run eslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha --allow-console-logs \"dist/__tests__\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/*/.js && npm run posttest",
"docker:build": "docker build -t identity_provider .",
"docker:run": "docker run -p 3000:3000 -d identity_provider",
"migrate": "node ./dist/migrate",
"prestart": "npm run build",
"start": "node -r source-map-support/register .",
"clean": "lb-clean dist .tsbuildinfo .eslintcache"
},
"repository": {
"type": "git"
},
"author": "",
"license": "",
"files": [
"README.md",
"dist",
"src",
"!/__tests__"
],
"dependencies": {
"@loopback/boot": "^2.3.0",
"@loopback/context": "^3.8.0",
"@loopback/core": "^2.6.0",
"@loopback/openapi-v3": "^3.4.0",
"@loopback/repository": "^2.5.0",
"@loopback/rest": "^5.0.0",
"@loopback/rest-explorer": "^2.2.1",
"@loopback/service-proxy": "^2.2.1",
"loopback-connector-postgresql": "^3.9.1",
"tslib": "^1.10.0"
},
"devDependencies": {
"@loopback/build": "^5.4.0",
"source-map-support": "^0.5.19",
"@loopback/testlab": "^3.1.4",
"@types/node": "^10.17.21",
"@loopback/eslint-config": "^7.0.0",
"eslint": "^7.0.0",
"typescript": "~3.9.2"
}
}
Hi, I got similar issue with postgresql and loopback4. I created the datasource with
lb4 datasourcecommand, then repository, controller and when I want to test it, I got a time out error. I've already donenpm run clean - npm run build, deleted the node_modules folder and run npm install but I got same error. Could some one tell me what am I doing wrong?
By the way I'm following the todo tutorial of loopback page with some modifications.
package.json
{
"name": "identity_provider",
"version": "1.0.0",
"description": "Backend for aunthentication and authorization",
"keywords": [
"loopback-application",
"loopback"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=10"
},
"scripts": {
"build": "lb-tsc",
"build:watch": "lb-tsc --watch",
"lint": "npm run prettier:check && npm run eslint",
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
"prettier:cli": "lb-prettier "/.ts" "/_.js"", "prettier:check": "npm run prettier:cli -- -l", "prettier:fix": "npm run prettier:cli -- --write", "eslint": "lb-eslint --report-unused-disable-directives .", "eslint:fix": "npm run eslint -- --fix", "pretest": "npm run clean && npm run build", "test": "lb-mocha --allow-console-logs "dist/tests"", "posttest": "npm run lint", "test:dev": "lb-mocha --allow-console-logs dist/tests//_.js && npm run posttest",
"docker:build": "docker build -t identity_provider .",
"docker:run": "docker run -p 3000:3000 -d identity_provider",
"migrate": "node ./dist/migrate",
"prestart": "npm run build",
"start": "node -r source-map-support/register .",
"clean": "lb-clean dist _.tsbuildinfo .eslintcache" }, "repository": { "type": "git" }, "author": "", "license": "", "files": [ "README.md", "dist", "src", "!_/tests*"
],
"dependencies": {
"@loopback/boot": "^2.3.0",
"@loopback/context": "^3.8.0",
"@loopback/core": "^2.6.0",
"@loopback/openapi-v3": "^3.4.0",
"@loopback/repository": "^2.5.0",
"@loopback/rest": "^5.0.0",
"@loopback/rest-explorer": "^2.2.1",
"@loopback/service-proxy": "^2.2.1",
"loopback-connector-postgresql": "^3.9.1",
"tslib": "^1.10.0"
},
"devDependencies": {
"@loopback/build": "^5.4.0",
"source-map-support": "^0.5.19",
"@loopback/testlab": "^3.1.4",
"@types/node": "^10.17.21",
"@loopback/eslint-config": "^7.0.0",
"eslint": "^7.0.0",
"typescript": "~3.9.2"
}
}
I forgot to mention that I was using node current version 14.3.0. A suggestion of a colleague to change to LTS version 12.17.0, and it worked, no more timeout so I think it's a bug in the _loopback-connector-postgresql_ with the current version of nodejs
@danielalejandrin Thank you for letting us know. Can you open a bug against pg - https://github.com/brianc/node-postgres/issues?
Hi guys, hello @danielalejandrin I'm still facing the same issue. Currently using node version 12.17.0 and the migrate command still fails.
Ensure that you're using a supported version of Node.js: v10, v12, v14.
Hi,
I got the same issue, with Node LTS (14.15.1) i use n to downgrade at 12.16.2 and it works fine.
@danielalejandrin Thank you for letting us know. Can you open a bug against
pg- https://github.com/brianc/node-postgres/issues?
Sorry not to open an issue but and new with node js and I was trying a framework to use instead of express, and I drop it cause I using express with sequalize ORM
Most helpful comment
Hi,
I got the same issue, with Node LTS (14.15.1) i use n to downgrade at 12.16.2 and it works fine.