TypeError: Cannot read property 'id' of undefined
fedealconada opened this issue · 1 comments
fedealconada commented
I noticed that when using api.ai module AND webhooks module at the same time, this error appears:
TypeError: Cannot read property 'id' of undefined at incomingMiddleware (/Users/me/project/node_modules/botpress-api.ai/bin/webpack:/src/index.js:42:21) at exec (/Users/me/project/node_modules/mware/index.js:50:23) at next (/Users/me/project/node_modules/mware/index.js:60:9) at processIncoming (/Users/fedealconada/Documents/Desarrollo/Sirius ...
fedealconada commented
This is because api.ai incoming middleware is catching the webhook request but no event.user is defined. My proposed solution is to check if the user exists and if not, just skip it and continue (next()
).