Я получил эту ошибку после развертывания моего API на heroku "подключить ECONNREFUSED 127.0.0.1:3306" - PullRequest
1 голос
/ 07 января 2020
const Sequelize = require('sequelize');

const sequelize = new Sequelize(`${process.env.SQL_DB}`, 'root', `${process.env.SQL_Password}`, {
    dialect: 'mysql',
    host: 'localhost'
});

module.exports = sequelize;

, хотя я сохранил свою конфигурационную переменную в настройках heroku, но она не может соединиться с моей базой данных. Я думаю

ошибки

Unhandled rejection SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306
2020-01-07T10:27:38.586244+00:00 app[web.1]:     at /app/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:139:19
2020-01-07T10:27:38.586246+00:00 app[web.1]:     at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
2020-01-07T10:27:38.586248+00:00 app[web.1]:     at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:547:31)
2020-01-07T10:27:38.586250+00:00 app[web.1]:     at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:604:18)
2020-01-07T10:27:38.586252+00:00 app[web.1]:     at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:649:10)
2020-01-07T10:27:38.586254+00:00 app[web.1]:     at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:725:18)
2020-01-07T10:27:38.586256+00:00 app[web.1]:     at _drainQueueStep (/app/node_modules/bluebird/js/release/async.js:93:12)
2020-01-07T10:27:38.586258+00:00 app[web.1]:     at _drainQueue (/app/node_modules/bluebird/js/release/async.js:86:9)
2020-01-07T10:27:38.586260+00:00 app[web.1]:     at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:102:5)
2020-01-07T10:27:38.586262+00:00 app[web.1]:     at Immediate.Async.drainQueues [as _onImmediate] (/app/node_modules/bluebird/js/release/async.js:15:14)
2020-01-07T10:27:38.586264+00:00 app[web.1]:     at processImmediate (internal/timers.js:439:21)
...