orangecoding/fredy

Notification trigger issue

saschnet opened this issue · 3 comments

Hi and thank you for your efforts into this nice project!

I installed the docker container but I cannot set up any notifications (besides Console). I tried MailJet and Telegram but get a http timeout (no error message after all) after clicking on Try and an error shows up in the logs.

Mailjet log error:
fredy | (node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property 'apiPublicKey' of 'notificationConfig.find(...).fields' as it is undefined.
fredy | at Object.exports.send (/usr/src/fredy/lib/notification/adapter/mailJet.js:20:11)
fredy | at /usr/src/fredy/lib/api/routes/notificationAdapterRouter.js:28:13
fredy | at next (/usr/src/fredy/node_modules/0http/lib/next.js:32:14)
fredy | at Trouter.router.lookup (/usr/src/fredy/node_modules/0http/lib/router/sequential.js:93:14)
fredy | at Object.service.lookup (/usr/src/fredy/node_modules/restana/libs/request-router.js:62:49)
fredy | at next (/usr/src/fredy/node_modules/0http/lib/next.js:30:25)
fredy | at step (/usr/src/fredy/node_modules/0http/lib/next.js:15:14)
fredy | at /usr/src/fredy/lib/api/security.js:26:7
fredy | at next (/usr/src/fredy/node_modules/0http/lib/next.js:32:14)
fredy | at step (/usr/src/fredy/node_modules/0http/lib/next.js:15:14)
fredy | at serveStatic (/usr/src/fredy/node_modules/serve-static/index.js:75:16)
fredy | at next (/usr/src/fredy/node_modules/0http/lib/next.js:32:14)
fredy | at step (/usr/src/fredy/node_modules/0http/lib/next.js:15:14)
fredy | at _cookieSession (/usr/src/fredy/node_modules/cookie-session/index.js:126:5)
fredy | at next (/usr/src/fredy/node_modules/0http/lib/next.js:32:14)
fredy | at step (/usr/src/fredy/node_modules/0http/lib/next.js:15:14)
fredy | (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)

And for telegram:
fredy | (node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property 'token' of 'notificationConfig.find(...).fields' as it is undefined.
fredy | at Object.exports.send (/usr/src/fredy/lib/notification/adapter/telegram.js:14:11)
fredy | at /usr/src/fredy/lib/api/routes/notificationAdapterRouter.js:28:13
fredy | at next (/usr/src/fredy/node_modules/0http/lib/next.js:32:14)
fredy | at Trouter.router.lookup (/usr/src/fredy/node_modules/0http/lib/router/sequential.js:93:14)
fredy | at Object.service.lookup (/usr/src/fredy/node_modules/restana/libs/request-router.js:62:49)
fredy | at next (/usr/src/fredy/node_modules/0http/lib/next.js:30:25)
fredy | at step (/usr/src/fredy/node_modules/0http/lib/next.js:15:14)
fredy | at /usr/src/fredy/lib/api/security.js:26:7
fredy | at next (/usr/src/fredy/node_modules/0http/lib/next.js:32:14)
fredy | at step (/usr/src/fredy/node_modules/0http/lib/next.js:15:14)
fredy | at serveStatic (/usr/src/fredy/node_modules/serve-static/index.js:75:16)
fredy | at next (/usr/src/fredy/node_modules/0http/lib/next.js:32:14)
fredy | at step (/usr/src/fredy/node_modules/0http/lib/next.js:15:14)
fredy | at _cookieSession (/usr/src/fredy/node_modules/cookie-session/index.js:126:5)
fredy | at next (/usr/src/fredy/node_modules/0http/lib/next.js:32:14)
fredy | at step (/usr/src/fredy/node_modules/0http/lib/next.js:15:14)
fredy | (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

The notification itself seems to work fine, only the try test functionality behaves unexpectedly.

Hi @saschnet

thanks for reporting. Indeed I found an issue in the try function. I've just pushed a fix for this, sorry, I missed it during refactorings ;)

See 0f27429

The notification itself seems to work fine, only the try test functionality behaves unexpectedly.

Just so that I understand correctly, the notifications are being triggered, your report basically was only about the "try function" which is now fixed?

Exactly, it is fixed now. Thank you!