orangecoding / fredy

:heart: Fredy - [F]ind [R]eal [E]states [D]amn Eas[y] - Fredy will constantly search for new listings on sites like Immoscout or Immowelt and send new results to you, so that you can focus on more important things in life ;)
http://www.orange-coding.net
MIT License
212 stars 54 forks source link

Notification trigger issue #18

Closed saschnet closed 3 years ago

saschnet commented 3 years ago

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)

saschnet commented 3 years ago

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

orangecoding commented 3 years ago

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 https://github.com/orangecoding/fredy/commit/0f27429fe0bf7a3a905334efdebfb24daebf04b4

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?

saschnet commented 3 years ago

Exactly, it is fixed now. Thank you!