How to fix TypeError: Cannot read property 'then' of undefined in Node.js | DevErrors