title: ConnectionError [SequelizeConnectionError]: Failed to connect to localhost:1433 - Could not connect (sequence) Node.js, Sequelize and Heroku
body: <p>I am trying to deploy my application to Heroku, the problem is when my application is trying to connect to the local SQL Server database doesn't work.</p>
  <p>When i test my application on development environment everything works good, the connection to the localhost:1433 works correctly.</p>
  <p>This is my DB config</p>
  <pre><code>const { Sequelize } = require('sequelize');
  
  // Connection to SQL Server
  const db = new Sequelize('Cafeteria', process.env.SQL_NAME, process.env.SQL_PASS, {
      host: 'localhost',
      dialect: 'mssql',
      // logging: false,
  });
  
  module.exports = db;
  </code></pre>
  <p>Connection in server.js</p>
  <pre><code>// Connection to DB
  async dbConnection() {
  
      try {
          
          await db.authenticate();
          console.log('Database online');
  
      } catch (error) {
          throw new Error( error );
      }
  
  }
  </code></pre>
  <p>And this is the error on console (Heroku logs)</p>
  <blockquote>
  <p>(node:21) UnhandledPromiseRejectionWarning: Error:
  SequelizeConnectionError: Failed to connect to localhost:1433 - Could
  not connect (sequence) at Server.dbConnection
  (/app/models/server.js:43:19) at processTicksAndRejections
  (internal/process/task_queues.js:93:5) at processTicksAndRejections
  (internal/process/task_queues.js:80:21) { code: 'ESOCKET' }</p>
  </blockquote>
  <p>Yes the TCP/IP is Enabled, the TCP Port is 1433, TCP Dynamic Ports are a blank space.</p>
  <p>The SQL Server Browser is running.</p>
  <p>I hope anyone can help me!</p>