Comments (15)
Had this same issue. I was calling
app.dataSources.postgres.disconnect();
at the end of the automigrate callback. But of course this is disconnecting the database from your running app! So in server/boot/ files, don't disconnect.
from loopback-connector-postgresql.
I have the same issue only in node >=14, works fine on 12 lts.
from loopback-connector-postgresql.
@transedward Any update here?
from loopback-connector-postgresql.
Today, I tired it again.
when I use autoupdate in server/boot/mock-data.js, all the get methods work
but if I change to automigrate, then the same error happens again.
from loopback-connector-postgresql.
im also getting same error. is there an update for the fix?
from loopback-connector-postgresql.
not yet, still have no idea of the error coming from
from loopback-connector-postgresql.
I just ran into the same problem when using automigrate.
from loopback-connector-postgresql.
Can you turn on debugging with env var DEBUG=loopback:connector:postgresql
to see what's going on?
from loopback-connector-postgresql.
@raymondfeng Hi, having reviewed the debug log it seems to be my own doing (why am I not surprised ;-) This issue initially seemed to fit the bill, but it turned out I was not experiencing the same problem as @transedward. Sorry for the inconvenience.
from loopback-connector-postgresql.
@FreakTheMighty this may be causing the server timeouts on deployment #77 (comment) or the fact that we arent calling it, which could be causing the migration to hang and then the app to not be able to connect
from loopback-connector-postgresql.
I am facing same issue. Any solutions yet?
from loopback-connector-postgresql.
Could someone provide a sample repo to reproduce the issue with?
http://loopback.io/doc/en/contrib/Reporting-issues.html#bug-report
from loopback-connector-postgresql.
Guys same issue, but at my local just run, slc run and works
from loopback-connector-postgresql.
It is no longer an issue with the latest postgresql connector.
Dependency tree:
sakibs-mac:postgresql-77 ssh$ npm ls --depth 0
[email protected] /Users/ssh/workspace/sandbox/loopback-sandbox/apps/postgresql/postgresql-77
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
Here is a sample reproduction:
model-definition.json
{
"name": "Employee",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "number"
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
boot-script.js
'use strict';
var util = require('util');
var _ = require('lodash');
module.exports = function(app) {
var db = app.datasources.postgresqlDs;
var Employee = app.models.Employee;
db.automigrate(function(err) {
if (err) throw err;
console.log('\nAutomigrate completed');
Employee.create([{
name: 'Foo',
age: 12
}, {
name: 'Bar',
age: 25
}, {
name: 'Baz'
}], function (err, result) {
if (err) throw err;
console.log('\nCreated instance: ' + util.inspect(result));
db.autoupdate(function(err) {
if (err) throw err;
console.log('\nAutoupdate complete');
});
});
});
};
output
sakibs-mac:postgresql-77 ssh$ node .
Web server listening at: http://0.0.0.0:3000
Browse your REST API at http://0.0.0.0:3000/explorer
Automigrate completed
Created instance: [ { name: 'Foo', age: 12, id: 1 },
{ name: 'Bar', age: 25, id: 2 },
{ name: 'Baz', id: 3 } ]
Autoupdate complete
Closing this issue as it is not a bug anymore. Feel free to reopen if needed.
from loopback-connector-postgresql.
Sadly, it's a problem for mongodb connector.
Unhandled rejection Error: Timeout in connecting after 5000 ms
at Timeout._onTimeout (/home/harry/Projects/my-project/node_modules/loopback-datasource-juggler/lib/datasource.js:2529:10)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
"dependencies": {
"base64-to-uint8array": "^1.0.0",
"buffer": "^5.1.0",
"compression": "^1.0.3",
"cors": "^2.5.2",
"express-jwt": "^5.3.1",
"file-type": "^7.7.1",
"helmet": "^3.12.1",
"jsonwebtoken": "^8.2.1",
"lodash": "^4.17.4",
"loopback": "^3.19.0",
"loopback-boot": "^2.6.5",
"loopback-component-explorer": "^6.0.1",
"loopback-component-storage": "^3.3.1",
"loopback-connector-mongodb": "^3.4.3",
"moment": "^2.22.1",
"nodemon": "^1.17.4",
"serve-favicon": "^2.5.0",
"simpl-schema": "^1.4.2",
"strong-error-handler": "^2.0.0",
"underscore.string": "^3.3.4"
},
"devDependencies": {
"eslint": "^4.19.1",
"eslint-config-loopback": "^10.0.0",
"eslint-plugin-prettier": "^2.6.0",
"nsp": "^3.2.1",
"prettier": "^1.11.1",
"prettierrc": "0.0.0-5"
}
I tried updating most of my packages and double checked the datasource configurations. Also, I tried to directly connect to mongodb and had no problems at all. But it's worth noting that my mongodb version I'm currently running is 3.6.3 which is the latest version I presume.
datasource.json
{
"db": {
"name": "db",
"connector": "memory"
},
"MongoDS": {
"name": "MongoDS",
"connector": "mongodb",
"url": "mongodb://localhost:27017/middleware"
},
"fileStorage": {
"name": "fileStorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./server/containers"
}
}
from loopback-connector-postgresql.
Related Issues (20)
- Postgresql column as text[] or character varying() is returning data as string HOT 8
- Query with AND & OR combination is not working HOT 2
- Error when using transaction timeout HOT 6
- Postgres support > 9.x HOT 4
- LB4 with [email protected] causing SSL Error HOT 4
- eq object (JSON columns) doesn't work HOT 6
- Error: syntax error at or near ")"
- Support for Full Text Search
- Option to use joins instead of multiple calls for relations. HOT 1
- Release called on client which has already been released to the pool HOT 2
- Doesn't scramble the where correctly
- If url is empty string in config server crashes HOT 2
- Dependency Dashboard
- Add back Node.js v12 tests HOT 4
- Support bulk insert in one query using newly added createAll() in connector
- Error: Postgresql column as jsonb returning data as string using createAll() method HOT 2
- MongoDB extended operator rules erroneously applied to SQL databases and json bodies
- Default values in Models properties totally being ignored when using migrateschema. HOT 1
- Support for overlaps json operator
- Getting 5000ms Timeout error while connecting Postgres - I'm using node version 16.0.0, still running into the same problem. And I'm using the latest Postgres connector: `^7.0.1`. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loopback-connector-postgresql.