You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sync() does not return error when db connection is erroneous #10144
constsequelize=newSequelize({database: 'some-invalid-name'// notice heredialect: 'postgre',host: 'some-funny-string',// notice hereoperatorsAliases: false,password: dbConfig.password,pool: {acquire: 30000,idle: 10000,max: dbConfig.poolMax,min: dbConfig.poolMin,},port: dbConfig.port,username: dbConfig.username,});/* ...sequelize.import */sequelize.sync().then(()=>{// this succeeds even if the credentials are invalid}).catch((err)=>{// never gets here})
What do you expect to happen?
sync() is supposed to fail. Just as authenticate() returns error, for example.
/* ... */sequelize.authenticate().then(()=>{}).catch(()=>{// the same sequelize instance gets here, just as expected })
What is actually happening?
sync() succeeds, no matter what the values of credential are.
Is it how sequelize is designed to work? I believe not. sync() should at least warn the developers if the connection could be invalid.
Dialect: postgres Dialect version: 10.1 Database version: postgres 10.1 Sequelize version: 4.38 Tested with latest release: No (If yes, specify that version)
Note :Your issue may be ignored OR closed by maintainers if it's not tested against latest version OR does not follow issue template.
Activity
eldenpark commentedon Nov 10, 2018
A similar observation was made in 2014, #1207