Environment
MagicMirror version: 2.37.0
Node.js version: 24.11.0
npm version: 11.11.0
Platform: Raspberry Pi 5
Operating system: Raspberry Pi OS Bookworm
Process manager: PM2
Which start option are you using?
node --run start:x11
Are you using PM2?
Yes
Module
newsfeed
Have you tried disabling other modules?
Have you searched if someone else has already reported the issue on the forum or in the issues?
What did you do?
Newsfeed crashes when an Atom summary is parsed as an object
Description
The default newsfeed module fails to process the VRT NWS Atom feed:
https://www.vrt.be/vrtnieuws/nl.rss.articles.xml
MagicMirror logs the following error:
[ERROR] [newsfeed] https://www.vrt.be/vrtnieuws/nl.rss.articles.xml - Stream processing failed: this.buffers[0].slice is not a function
[ERROR] [newsfeed] Error: Could not fetch newsfeed: https://www.vrt.be/vrtnieuws/nl.rss.articles.xml Stream processing failed: this.buffers[0].slice is not a function
Environment
- MagicMirror version: 2.37.0
- Node.js version: 24.11.0
- npm version: 11.11.0
- Platform: Raspberry Pi 5
- Operating system: Raspberry Pi OS Bookworm
- Process manager: PM2
Reproduction
Configure the default newsfeed module with:
{
title: "VRT NWS",
url: "https://www.vrt.be/vrtnieuws/nl.rss.articles.xml"
}
Restart MagicMirror.
The feed is downloaded successfully, but processing fails with:
this.buffers[0].slice is not a function
The URL responds successfully after its redirect:
HTTP/2 301
HTTP/2 200
content-type: application/atom+xml;charset=utf-8
Investigation
Parsing all 50 feed entries with feedme showed that five entries return summary as an object rather than a string:
ITEM 2 FIELD summary TYPE object VALUE { type: 'text' }
ITEM 4 FIELD summary TYPE object VALUE { type: 'text' }
ITEM 6 FIELD summary TYPE object VALUE { type: 'text' }
ITEM 45 FIELD summary TYPE object VALUE { type: 'text' }
ITEM 47 FIELD summary TYPE object VALUE { type: 'text' }
Finished: 50 items, 5 non-string fields
The relevant code in defaultmodules/newsfeed/newsfeedfetcher.js selects the first available description field:
let description = item.description || item.summary || item.content || "";
It later passes description to htmlToText() without checking whether it is a string.
When description is { type: "text" }, html-to-text/htmlparser2 ultimately throws:
this.buffers[0].slice is not a function
Workaround
Adding a type guard before calling htmlToText() prevents the whole feed from failing:
let description = item.description || item.summary || item.content || "";
if (typeof description !== "string") {
Log.warn(`Unexpected non-string description for ${this.url}:`, description);
description = "";
}
After this change, the VRT newsfeed loads normally. Entries with object-valued summaries are retained with an empty description instead of crashing the complete feed.
Expected behavior
A malformed or unusually parsed description or summary in one feed item should not prevent the entire feed from loading.
The newsfeed module should either:
- normalize supported object structures into text;
- discard only the invalid description field; or
- skip only the affected item while continuing to process the remaining entries.
What did you expect to happen?
A malformed or unusually parsed description or summary in one feed item should not prevent the entire feed from loading.
The newsfeed module should either:
- normalize supported object structures into text;
- discard only the invalid description field; or
- skip only the affected item while continuing to process the remaining entries.
What actually happened?
The default newsfeed module fails to process the VRT NWS Atom feed:
https://www.vrt.be/vrtnieuws/nl.rss.articles.xml
MagicMirror logs the following error:
[ERROR] [newsfeed] https://www.vrt.be/vrtnieuws/nl.rss.articles.xml - Stream processing failed: this.buffers[0].slice is not a function
[ERROR] [newsfeed] Error: Could not fetch newsfeed: https://www.vrt.be/vrtnieuws/nl.rss.articles.xml Stream processing failed: this.buffers[0].slice is not a function
Additional comments
diff --git a/defaultmodules/newsfeed/newsfeedfetcher.js b/defaultmodules/newsfeed/newsfeedfetcher.js
index b6b86fe5..5e2ae3a7 100644
--- a/defaultmodules/newsfeed/newsfeedfetcher.js
+++ b/defaultmodules/newsfeed/newsfeedfetcher.js
@@ -152,6 +152,10 @@ class NewsfeedFetcher {
parser.on("item", (item) => {
const title = item.title;
let description = item.description || item.summary || item.content || "";
-
if (typeof description !== "string") {
-
Log.warn(`Unexpected non-string description for ${this.url}:`, description);
-
-
}
const pubdate = item.pubdate || item.published || item.updated || item["dc:date"] || item["a10:updated"];
const url = item.url || item.link || "";
Participation
Environment
MagicMirror version: 2.37.0
Node.js version: 24.11.0
npm version: 11.11.0
Platform: Raspberry Pi 5
Operating system: Raspberry Pi OS Bookworm
Process manager: PM2
Which start option are you using?
node --run start:x11
Are you using PM2?
Yes
Module
newsfeed
Have you tried disabling other modules?
Have you searched if someone else has already reported the issue on the forum or in the issues?
What did you do?
Newsfeed crashes when an Atom summary is parsed as an object
Description
The default
newsfeedmodule fails to process the VRT NWS Atom feed:https://www.vrt.be/vrtnieuws/nl.rss.articles.xmlMagicMirror logs the following error:
Environment
Reproduction
Configure the default newsfeed module with:
Restart MagicMirror.
The feed is downloaded successfully, but processing fails with:
The URL responds successfully after its redirect:
Investigation
Parsing all 50 feed entries with
feedmeshowed that five entries returnsummaryas an object rather than a string:The relevant code in
defaultmodules/newsfeed/newsfeedfetcher.jsselects the first available description field:It later passes
descriptiontohtmlToText()without checking whether it is a string.When
descriptionis{ type: "text" },html-to-text/htmlparser2ultimately throws:Workaround
Adding a type guard before calling
htmlToText()prevents the whole feed from failing:After this change, the VRT newsfeed loads normally. Entries with object-valued summaries are retained with an empty description instead of crashing the complete feed.
Expected behavior
A malformed or unusually parsed description or summary in one feed item should not prevent the entire feed from loading.
The newsfeed module should either:
What did you expect to happen?
A malformed or unusually parsed description or summary in one feed item should not prevent the entire feed from loading.
The newsfeed module should either:
What actually happened?
The default newsfeed module fails to process the VRT NWS Atom feed:
https://www.vrt.be/vrtnieuws/nl.rss.articles.xml
MagicMirror logs the following error:
[ERROR] [newsfeed] https://www.vrt.be/vrtnieuws/nl.rss.articles.xml - Stream processing failed: this.buffers[0].slice is not a function
[ERROR] [newsfeed] Error: Could not fetch newsfeed: https://www.vrt.be/vrtnieuws/nl.rss.articles.xml Stream processing failed: this.buffers[0].slice is not a function
Additional comments
diff --git a/defaultmodules/newsfeed/newsfeedfetcher.js b/defaultmodules/newsfeed/newsfeedfetcher.js
index b6b86fe5..5e2ae3a7 100644
--- a/defaultmodules/newsfeed/newsfeedfetcher.js
+++ b/defaultmodules/newsfeed/newsfeedfetcher.js
@@ -152,6 +152,10 @@ class NewsfeedFetcher {
parser.on("item", (item) => {
const title = item.title;
let description = item.description || item.summary || item.content || "";
Participation