Error: Dialect needs to be explicitly supplied as of v4.0.0 - being thrown even though mysql is supplied in two files
See original GitHub issueWhat you are doing?
______
// index.js
if (config.use_env_variable) {
var sequelize = new Sequelize(process.env[config.use_env_variable]);
} else {
var sequelize = new Sequelize('burger_shop_DB', 'root', 'hoist', {
host: "127.0.0.1",
dialect: 'mysql',
define: {
timestamps: false
}
});
//config.json
"production": {
"use_env_variable" : "JAWS_URL",
"dialect": "mysql"
}
}
}
preface:
zobri@LAPTOP-OKM3KH21 MINGW64 ~/UAbcProjects/sequelizedBurger (master) $ sequelize -v Sequelize [Node: 6.11.1, CLI: 2.7.0, ORM: 4.4.2]
What do you expect to happen?
I’m trying to host my sequelize app on Heroku
What is actually happening?
/app/node_modules/sequelize/lib/sequelize.js:169
Aug 05 22:09:54 seq-eat-da-burga app/web.1: throw new Error(‘Dialect needs to be explicitly
supplied as of v4.0.0’);
Aug 05 22:09:54 seq-eat-da-burga app/web.1: ^
Aug 05 22:09:54 seq-eat-da-burga app/web.1: Error: Dialect needs to be explicitly supplied as of v4.0.0
at new Sequelize
(/app/node_modules/sequelize/lib/sequelize.js:169:13)
at Object.<anonymous> (/app/models/index.js:12:21)
Reference my index.js snippet above, where MySQL is implicitly stored as dialect
I noticed you closed a similar issue 5 days ago, which stumped the heck out of me while trying to debug - any guidance would be greatly appreciated.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
face the same issue and fixed it by setting the
NODE_ENV
to the specified environment in theconfig.json
Check your config file (env names)