Ran into this error and was able to bypass it. Hope this helps. Here is what the AI has to say about it:
This isn't an auth/credentials/network problem — I've traced it to a specific upstream regression and confirmed it's environment-driven, not config-driven.
Root cause
- nodejs/node#63989 — a confirmed regression in Node.js v24.17.0 (changes to
http.Agent keep-alive socket reuse) that breaks under load. v24.16.0 and earlier are unaffected.
- That regression exposes a latent bug in
node-fetch@2 — node-fetch/node-fetch#1767 — whose malformed-chunked-response detector throws false-positive ERR_STREAM_PREMATURE_CLOSE on reused keep-alive sockets.
gaxios@6 (the transport behind googleapis/google-auth-library) falls back to node-fetch@2 whenever there's no browser window global — which is always true for a MagicMirror node_helper.js, since it runs inside Electron's main process. So this hits every install running an Electron build that bundles Node ≥24.17.0.
- Confirmed reproducible standalone via
ELECTRON_RUN_AS_NODE=1 electron -e ... with the exact same credentials — i.e. it's the Electron-bundled Node runtime itself, not network/DNS/proxy/IPv6 (all separately ruled out) and not anything specific to my machine.
- Same failure independently reported hitting Railway deployments, Firebase CLI in Cloud Build, and Deno — so it's a broad ecosystem issue, not particular to this module or to Electron.
Why this is worth flagging here
Since every MagicMirror install runs node_helper.js inside Electron's main process, every user who updates to a current Electron release will hit this the moment Electron bundles Node ≥24.17.0 — with no config change on their end. It'll likely present to users as "calendar just stopped working" with a confusing gaxios stack trace, same as it did for me.
Workaround
Bypassing googleapis/gaxios for the runtime OAuth refresh + Calendar API calls, and using Node's built-in https module directly, avoids the bug entirely (confirmed working). Happy to share the patch/open a PR if useful — it's a fairly small, self-contained change to node_helper.js's token-refresh and events.list calls.
Environment
- Electron 42.5.2 (bundled Node 24.17.0)
googleapis/google-auth-library via gaxios 6.7.1 → node-fetch 2.7.0
- Raspberry Pi 5, Debian 12, MagicMirror 2.37.0
Ran into this error and was able to bypass it. Hope this helps. Here is what the AI has to say about it:
This isn't an auth/credentials/network problem — I've traced it to a specific upstream regression and confirmed it's environment-driven, not config-driven.
Root cause
http.Agentkeep-alive socket reuse) that breaks under load. v24.16.0 and earlier are unaffected.node-fetch@2— node-fetch/node-fetch#1767 — whose malformed-chunked-response detector throws false-positiveERR_STREAM_PREMATURE_CLOSEon reused keep-alive sockets.gaxios@6(the transport behindgoogleapis/google-auth-library) falls back tonode-fetch@2whenever there's no browserwindowglobal — which is always true for a MagicMirrornode_helper.js, since it runs inside Electron's main process. So this hits every install running an Electron build that bundles Node ≥24.17.0.ELECTRON_RUN_AS_NODE=1 electron -e ...with the exact same credentials — i.e. it's the Electron-bundled Node runtime itself, not network/DNS/proxy/IPv6 (all separately ruled out) and not anything specific to my machine.Why this is worth flagging here
Since every MagicMirror install runs
node_helper.jsinside Electron's main process, every user who updates to a current Electron release will hit this the moment Electron bundles Node ≥24.17.0 — with no config change on their end. It'll likely present to users as "calendar just stopped working" with a confusing gaxios stack trace, same as it did for me.Workaround
Bypassing
googleapis/gaxiosfor the runtime OAuth refresh + Calendar API calls, and using Node's built-inhttpsmodule directly, avoids the bug entirely (confirmed working). Happy to share the patch/open a PR if useful — it's a fairly small, self-contained change tonode_helper.js's token-refresh andevents.listcalls.Environment
googleapis/google-auth-libraryviagaxios6.7.1 →node-fetch2.7.0