admin管理员组

文章数量:1290976

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",
    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?

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",
    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?

Share Improve this question edited May 13, 2019 at 13:31 BML91 asked May 13, 2019 at 13:22 BML91BML91 3,1904 gold badges36 silver badges56 bronze badges 1
  • github./sequelize/sequelize/issues/3240 this issue also leads me to believe what I have above is correct. Though it isn't working. – BML91 Commented May 13, 2019 at 13:25
Add a ment  | 

2 Answers 2

Reset to default 9

This should fix the issue,

module.exports = {
  development: {
    username: "USER",
    password: "PASSWORD",
    database: "DB_NAME",
    host: "HOST",
    dialect: 'mssql',
    dialectOptions: { 
      options: {
        encrypt: true
      }
    }
  } 
};

Edit your config.js

module.exports = {
  url: process.env.DATABASE_URL,
  dialectOptions: {
    ssl: {
      require: true,
      rejectUnauthorized: false,
    },
  },
};

本文标签: javascriptSet encrypt to true on Sequelizecli migrate for MSSQLStack Overflow