You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two plugins crash at runtime with TypeError when processing GitHub API events:
plugin_activity — fails at index.mjs:140 trying to call .filter() on undefined
plugin_languages with recently-used section — fails at recent.mjs:70 trying to destructure committer from undefined
Both errors occur when the plugins attempt to process events returned by the GitHub REST API. The issue appears to be that certain event payloads returned by the API have an unexpected or missing structure, causing the plugins to crash when iterating over them.
Both plugins produce an Unexpected error message in the generated SVG (when the process doesn't exit entirely), and no SVG is committed.
Environment
Field
Value
Metrics version
3.34.0 (prebuilt image, also reproduced on @latest)
Also reproduced with plugin_activity_filter: issue, pr, release, push, review, star, fork and plugin_activity_days: 90.
Error
TypeError: Cannot read properties of undefined (reading 'filter')
at file:///metrics/source/plugins/activity/index.mjs:140:33
at Array.map (<anonymous>)
at Object.default [as activity] (file:///metrics/source/plugins/activity/index.mjs:46:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///metrics/source/plugins/core/index.mjs:67:30
at async Promise.all (index 0)
at async metrics (file:///metrics/source/app/metrics/index.mjs:81:22)
at async retry.retries.retries (file:///metrics/source/app/action/index.mjs:407:40)
at async retry (file:///metrics/source/app/action/index.mjs:57:22)
at async file:///metrics/source/app/action/index.mjs:406:28
The error occurs at source/plugins/activity/index.mjs:140 inside an Array.map(), suggesting that one of the events returned by the GitHub API is missing a property that the plugin expects (likely payload or a sub-field of it).
Also reproduced without plugin_languages_indepth: yes and with various combinations of plugin_languages_ignored, plugin_languages_other, plugin_languages_recent_days, and plugin_languages_recent_load.
Error
TypeError: Cannot destructure property 'committer' of 'undefined' as it is undefined.
at file:///metrics/source/plugins/languages/analyzer/recent.mjs:70:21
at Array.filter (<anonymous>)
at RecentAnalyzer.patches (file:///metrics/source/plugins/languages/analyzer/recent.mjs:70:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RecentAnalyzer.analyze (file:///metrics/source/plugins/languages/analyzer/recent.mjs:25:21)
at async file:///metrics/source/plugins/languages/analyzer/recent.mjs:19:7
at async results (file:///metrics/source/plugins/languages/analyzer/analyzer.mjs:63:7)
Node.js v20.6.1
Error: Process completed with exit code 1.
The error occurs at source/plugins/languages/analyzer/recent.mjs:70 inside RecentAnalyzer.patches(), where a commit object is expected to have a committer property but receives undefined instead — likely a push event with a malformed or truncated commit entry from the GitHub API.
Root Cause (hypothesis)
Both plugins iterate over GitHub API event payloads without null-checking nested properties. The GitHub API can return push events with commits that have null or missing fields (e.g. committer, payload). Neither plugin guards against this, causing a crash on the first malformed event encountered.
A fix would be to add optional chaining or explicit null checks before accessing nested properties:
source/plugins/activity/index.mjs around line 140
source/plugins/languages/analyzer/recent.mjs around line 70
Expected behavior
The plugins should skip malformed or unexpected events gracefully and continue processing the remaining ones, rather than crashing entirely.
Steps to reproduce
Create a workflow with plugin_activity or plugin_languages with plugin_languages_sections: recently-used
Use GITHUB_TOKEN or any classic PAT
Run the workflow
Observe the TypeError in the logs
Additional notes
plugin_languages with most-used (default) works correctly
All other plugins (isocalendar, notable, repositories, rss, music) work correctly
The issue is not related to token scope — reproduced with both GITHUB_TOKEN and a PAT with repo scope
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Two plugins crash at runtime with
TypeErrorwhen processing GitHub API events:plugin_activity— fails atindex.mjs:140trying to call.filter()onundefinedplugin_languageswithrecently-usedsection — fails atrecent.mjs:70trying to destructurecommitterfromundefinedBoth errors occur when the plugins attempt to process events returned by the GitHub REST API. The issue appears to be that certain event payloads returned by the API have an unexpected or missing structure, causing the plugins to crash when iterating over them.
Both plugins produce an
Unexpected errormessage in the generated SVG (when the process doesn't exit entirely), and no SVG is committed.Environment
Plugin 1 —
plugin_activityConfiguration
Error
The error occurs at
source/plugins/activity/index.mjs:140inside anArray.map(), suggesting that one of the events returned by the GitHub API is missing a property that the plugin expects (likelypayloador a sub-field of it).Plugin 2 —
plugin_languageswithrecently-usedConfiguration
Error
The error occurs at
source/plugins/languages/analyzer/recent.mjs:70insideRecentAnalyzer.patches(), where a commit object is expected to have acommitterproperty but receivesundefinedinstead — likely a push event with a malformed or truncated commit entry from the GitHub API.Root Cause (hypothesis)
Both plugins iterate over GitHub API event payloads without null-checking nested properties. The GitHub API can return push events with commits that have
nullor missing fields (e.g.committer,payload). Neither plugin guards against this, causing a crash on the first malformed event encountered.A fix would be to add optional chaining or explicit null checks before accessing nested properties:
source/plugins/activity/index.mjsaround line 140source/plugins/languages/analyzer/recent.mjsaround line 70Expected behavior
The plugins should skip malformed or unexpected events gracefully and continue processing the remaining ones, rather than crashing entirely.
Steps to reproduce
plugin_activityorplugin_languageswithplugin_languages_sections: recently-usedGITHUB_TOKENor any classic PATTypeErrorin the logsAdditional notes
plugin_languageswithmost-used(default) works correctlyisocalendar,notable,repositories,rss,music) work correctlyGITHUB_TOKENand a PAT withreposcopeBeta Was this translation helpful? Give feedback.
All reactions