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 #57

Open
p4mr opened this issue Apr 19, 2024 · 3 comments
Open

UnhandledPromiseRejectionWarning #57

p4mr opened this issue Apr 19, 2024 · 3 comments

Comments

@p4mr
Copy link

p4mr commented Apr 19, 2024

Just updated MM to version 2.27.0, and discovered MMM-AirQuality no longer loads (data is stuck on Loading.....)

Running PM2 Log gives the below error trace

0|mm | [2024-04-19 12:28:11.472] [ERROR] (node:1100) UnhandledPromiseRejectionWarning: TypeError: fetch failed
0|mm | at Object.fetch (node:internal/deps/undici/undici:12293:11)
0|mm | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
0|mm | at async Class.loadData (/home/mirror/MagicMirror/modules/MMM-AirQuality/helper.js:21:20)
0|mm | (Use electron --trace-warnings ... to show where the warning was created)
0|mm | [2024-04-19 12:28:11.477] [ERROR] (node:1100) 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: 1)

@NashJames
Copy link

I've had this error for a while and just now looked into it. Seems a breaking bug was introduced by a node dependency and no fix has been released yet. You can follow the progress here

Alternatively, I've lowered my node version to v18, which uses a version of the dependency before the bug was introduced. This has fixed the issue for me so you can do that in the meantime. If you don't have it, I recommend installing nvm to make switching node versions easy

@uros76
Copy link

uros76 commented Jun 10, 2024

@NashJames hi. Which exact version of node works? I tried with v18.20.3 and no good. I get the same problem as mentioned in the above post. I also tried v18.0.0 and it doesn't help.

@NashJames
Copy link

@uros76 After trying again myself, it seems that this fixed some of my instances of the mirror and not others (they have differing project and module versions). It's possible I've missed something in the nodejs codebase.

According to this comment, they should release a proper fix with node v20.14.1. I plan to wait another 2 weeks and see if that resolves it. If not, an alternate rest library like got (which doesn't rely on fetch) might be the answer.

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

3 participants