Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnhandledPromiseRejectionWarning #42

Open
carsten-re opened this issue May 8, 2022 · 8 comments
Open

UnhandledPromiseRejectionWarning #42

carsten-re opened this issue May 8, 2022 · 8 comments

Comments

@carsten-re
Copy link

Hi,

I'm using node-red-contrib-dwd-local-weather 1.0.2 in Docker and I see some errors showing up:

(node:17) 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: 13)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at runMicrotasks (<anonymous>)
(node:17) UnhandledPromiseRejectionWarning: ReferenceError: response is not defined
    at /data/node_modules/node-red-contrib-dwd-local-weather/dwdweather.js:92:28
(node:17) 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: 11)
(node:17) 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: 9)
(node:17) 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: 7)

Should I be worried?
Best Regards,
Carsten

@ei23fxg
Copy link

ei23fxg commented May 8, 2022

Same here.
It's caused NodeRED crashes on multiple of my installations.
All at the same time ;-)
So it must be caused by some serverside changes or issues (DWD)
There is maybe some fix needed here, currently i had to delete all nodes.

@forstran58
Copy link

forstran58 commented May 8, 2022

As an emergency measure, I edited line 92 in /home/pi/.node-red/node_modules/node-red-contrib-dwd-local-weather/dwdweather.js, like:
} else {
reject("INVALD");
//reject(response.status + " " + response.statusText);
};
(That is line 91 - 94 on my nodered installation.)
Still no DWD data, but at least nodered does not crash, anymore.

@carsten-re
Copy link
Author

carsten-re commented May 9, 2022

...So it must be caused by some serverside changes or issues (DWD) There is maybe some fix needed here, currently i had to delete all nodes.
Yeah, looks promising that that's the case. On this page (https://www.dwd.de/DE/leistungen/met_verfahren_mosmix/met_verfahren_mosmix.html) is a link that point to the Open Data Server. And that certificate expired yesterday at Sun, 08 May 2022 14:03:12 GMT.

@carsten-re
Copy link
Author

The certificate on https://opendata.dwd.de/ is now replaced and the SSL issue is gone. NodeRed is able to get the values.

@ei23fxg
Copy link

ei23fxg commented May 9, 2022

But it should be catched and not cause a system to crash...

@carsten-re carsten-re reopened this May 9, 2022
@carsten-re
Copy link
Author

Ok, I have re-opened the issue. Let's see if it could be fixed.

@ei23fxg
Copy link

ei23fxg commented May 9, 2022

Ok, I have re-opened the issue. Let's see if it could be fixed.

In doubt some ugly try catch block should do it.

This is the uncatched error:

May 8 16:14:49 friday Node-RED[4198]: 8 May 16:14:49 - [red] Uncaught Exception:
May 8 16:14:49 friday Node-RED[4198]: 8 May 16:14:49 - [error] ReferenceError: response is not defined
May 8 16:14:49 friday Node-RED[4198]: at /home/user/.node-red/node_modules/node-red-contrib-dwd-local-weather/dwdweather.js:92:28
May 8 16:14:49 friday Node-RED[4198]: at runMicrotasks ()
May 8 16:14:49 friday Node-RED[4198]: at processTicksAndRejections (node:internal/process/task_queues:96:5)
May 8 16:14:49 friday systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
May 8 16:14:50 friday systemd[1]: nodered.service: Failed with result 'exit-code'.

Edit:
Ok I looked into it, it is just that a response never will be defined in the catch part. That has to be fixed.
forstran58 already showed kind of the right solution.

@c5te1n
Copy link
Owner

c5te1n commented May 12, 2022

Thanks for the error report, detailed analysis and suggested fix. I agree that the error handling needs to be more robust here and will fix this in the next version.

markuszeller added a commit to markuszeller/node-red-contrib-dwd-local-weather that referenced this issue Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants