Repository navigation
Description
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?
- Yes
- No
Have you searched if someone else has already reported the issue on the forum or in the issues?
- Yes
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:
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); -
description = ""; -
} const pubdate = item.pubdate || item.published || item.updated || item["dc:date"] || item["a10:updated"]; const url = item.url || item.link || "";
Participation
- I am willing to submit a pull request for this change.
Activity
KristjanESPERANTO commentedon Jul 25, 2026
Thanks for reporting this. We could add a workaround in MagicMirror, but I think it would be better to fix the issue upstream in FeedMe. I’ve opened a PR there: fent/feedme.js#58
KristjanESPERANTO commentedon Sep 16, 2026
Fixed via #4269 🙂
refactor(newsfeed): extract feed item normalization into feeditem.js (#…
KristjanESPERANTO commentedon Oct 26, 2026
It doesn't really matter anymore, but my PR for feedme.js has now been merged. So, theoretically, if
feedparser, our new parser (to which we switched via #4269 to solve this issue), ever runs into problems, we could migrate back. It's unlikely, but it's an option.At least the other projects that still use feedme.js can benefit from the fix 🙂