UnhandledPromiseRejectionWarning
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)
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
@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.
@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.