Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set encrypt to true on Sequelize-cli migrate for MSSQL

I'm trying to run sequelize-cli, specifically npx sequelize db:migrate.

I've created a config file in config/config.js which looks like this (obviously with correct credentials):

module.exports = {
  development: {
    username: "USER",
    password: "PASSWORD",
    database: "DB_NAME",
    host: "HOST.net",
    dialect: 'mssql',
    dialectOptions: {
      encrypt: "true" // bool - true - doesn't work either
    }
  }
};

However I'm receiving the following error:

ERROR: Server requires encryption, set 'encrypt' config option to true.

As you can see from my config I believe I have set encrypt to true. This is my understanding of how to set this option from the docs.

How can I successfully set encrypt to true?

like image 657
BML91 Avatar asked May 13 '19 13:05

BML91


People also ask

How to configure SSL encryption in SQL Server?

How to configure SSL encryption in SQL Server 1 Install the SQL Server certificate using Microsoft Management Console. ... 2 Configuring SQL Server to accept encrypted connections. ... 3 Configuring the SQL Server clients to use encrypted connections. ... 4 SSL encryption for failover clustering in SQL Server. ...

How to use Sequelize’s migration feature?

To use the migration feature, you need to install the Sequelize CLI tool named sequelize-cli. You can install it on your computer using NPM or Yarn. Because the CLI tool is used from the command line, you need to install it globally: Alternatively, you can also use the npx command to run sequelize-cli without installing it globally:

How to enable force encryption in SQL Server Native Client?

In the SQL Server Configuration Manager right-click SQL Server Native Client Configuration, and then click Properties. On the Flags tab, select Yes in the ForceEncryption box, then click OK.

How do I encrypt a package sent to SQL Server?

Packets sent from the application to the instance of SQL Server must be encrypted by the client TLS stack and decrypted by the server TLS stack. Packets sent from the instance of SQL Server to the application must be encrypted by the server TLS stack and decrypted by the client TLS stack.


1 Answers

This should fix the issue,

module.exports = {
  development: {
    username: "USER",
    password: "PASSWORD",
    database: "DB_NAME",
    host: "HOST.net",
    dialect: 'mssql',
    dialectOptions: { 
      options: {
        encrypt: true
      }
    }
  } 
};
like image 175
Felix Isaac Avatar answered Sep 28 '22 03:09

Felix Isaac