sequelize / sequelize-typescript

Decorators and some other features for sequelize
MIT License
2.78k stars 280 forks source link

UnhandledPromiseRejectionWarning: SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306 #895

Open ghost opened 3 years ago

ghost commented 3 years ago

(node:4) UnhandledPromiseRejectionWarning: SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306 2021-02-01T20:49:32.971894+00:00 app[worker.1]: at /app/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:123:19 2021-02-01T20:49:32.971895+00:00 app[worker.1]: at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23) 2021-02-01T20:49:32.971896+00:00 app[worker.1]: at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:512:31) 2021-02-01T20:49:32.971896+00:00 app[worker.1]: at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:569:18) 2021-02-01T20:49:32.971896+00:00 app[worker.1]: at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:614:10) 2021-02-01T20:49:32.971897+00:00 app[worker.1]: at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:689:18) 2021-02-01T20:49:32.971897+00:00 app[worker.1]: at Async._drainQueue (/app/node_modules/bluebird/js/release/async.js:133:16) 2021-02-01T20:49:32.971897+00:00 app[worker.1]: at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:143:10) 2021-02-01T20:49:32.971898+00:00 app[worker.1]: at Immediate.Async.drainQueues [as _onImmediate] (/app/node_modules/bluebird/js/release/async.js:17:14) 2021-02-01T20:49:32.971899+00:00 app[worker.1]: at processImmediate (internal/timers.js:461:21) 2021-02-01T20:49:32.972061+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) 2021-02-01T20:49:32.972203+00:00 app[worker.1]: (node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Note

Im running this on heroku, and when i run it on visual studio code its fine.

My Code

this.sequelize = new Sequelize({
      database: "*****",
      dialect: "mysql",
      host: "******",
      username: "*******",
      password: "*****",
      models: [User, Guild],
      logging: false,
      isolationLevel: "READ COMMITTED"
});
MTissini commented 3 years ago

with Heroku MySQL isnt free, do you have your database setted?

ghost commented 3 years ago

It’s local, on my computer. But it won’t connect to it

MTissini commented 3 years ago

@drisco you need to connect a database

ghost commented 3 years ago

Yes, it is my local database