"TypeError: app.use() requires a middleware function" (upgraded forest-express-sequelize to version 6)

Since I updated forest-express-sequelize npm package, I am getting this error when I start my application backend:

TypeError: app.use() requires a middleware function

Context

  • Package Version: forest-express-sequelize 6.1.2
  • Express Version: 4.16.3
  • Sequelize Version: 5.15.1
  • Database Dialect: PostgreSQL
  • Database Version: 9.5.19

Hey @rap2h :wave: ,
Could you also specify the version you were running before updating to the latest one?

If you’ve updated forest-express-sequelize from v5 to v6, did you follow this migrate from v5 to v6 documentation ?

I think your issue could be located in middlewares/forestadmin.js
It seems like

app.use(Liana.init( ...

should be replaced by

app.use(await Liana.init( ...

since Liana.init now return a promise.

2 Likes

Thank you @jeffladiray! I followed the migration guide and it works :+1: