Giter Site home page Giter Site logo

Comments (15)

cdock1029 avatar cdock1029 commented on May 23, 2024 4

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.

juanantoniodamianv avatar juanantoniodamianv commented on May 23, 2024 2

I have the same issue only in node >=14, works fine on 12 lts.

from loopback-connector-postgresql.

geekguy avatar geekguy commented on May 23, 2024 1

@transedward Any update here?

from loopback-connector-postgresql.

hungtuchen avatar hungtuchen commented on May 23, 2024

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.

wiredots01 avatar wiredots01 commented on May 23, 2024

im also getting same error. is there an update for the fix?

from loopback-connector-postgresql.

hungtuchen avatar hungtuchen commented on May 23, 2024

not yet, still have no idea of the error coming from

from loopback-connector-postgresql.

jreidal avatar jreidal commented on May 23, 2024

I just ran into the same problem when using automigrate.

from loopback-connector-postgresql.

raymondfeng avatar raymondfeng commented on May 23, 2024

Can you turn on debugging with env var DEBUG=loopback:connector:postgresql to see what's going on?

from loopback-connector-postgresql.

jreidal avatar jreidal commented on May 23, 2024

@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.

dancingshell avatar dancingshell commented on May 23, 2024

@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.

ketansp avatar ketansp commented on May 23, 2024

I am facing same issue. Any solutions yet?

from loopback-connector-postgresql.

0candy avatar 0candy commented on May 23, 2024

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.

marcus-gomes-v avatar marcus-gomes-v commented on May 23, 2024

Guys same issue, but at my local just run, slc run and works

from loopback-connector-postgresql.

ssh24 avatar ssh24 commented on May 23, 2024

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.

harryadel avatar harryadel commented on May 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.