question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

What 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:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

10reactions
yassin-moknicommented, Sep 9, 2017

face the same issue and fixed it by setting the NODE_ENV to the specified environment in the config.json

9reactions
sergiyvoytovychcommented, Oct 24, 2017

Check your config file (env names)

{
  development: {
    username: 'root',
    password: null,
    database: 'database_development',
    host: '127.0.0.1',
    dialect: 'mysql'
  },
  test: {
    username: 'root',
    password: null,
    database: 'database_test',
    host: '127.0.0.1',
    dialect: 'mysql'
  },
  production: {
    username: 'root',
    password: null,
    database: 'database_production',
    host: '127.0.0.1',
    dialect: 'mysql'
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Dialect needs to be explicitly supplied as of v4.0.0
A little background: I am using sequelize in a typescript project. And the database config file was in a database.ts file. const config...
Read more >
Dialect needs to be explicitly supplied as of v4.0.0 - CodeRanch
I am working on a tutorial for locking down Angular routes ( and have run into a error: "Dialect needs to be explicitly...
Read more >
Dialect needs to be explicitly supplied as of v4.0.0-postgresql
I have been working on a NodeJS project which uses PostgreSQL database. I am trying to implement migration to the database. Also, using...
Read more >
Dialect needs to be explicitly supplied as of v4.0.0 - Reddit
Hello, there! I'm trying to connect to my PostgreSQL server and it seems something wrong is happening with Sequelize connection.
Read more >
Sequelize 'Dialect needs to be explicitly supplied as of v4.0.0'
Node cannot find your environment to load in the config file. You can easily fix by running this export NODE_ENV=development; npx sequelize db:migrate....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found