Solution skill
customerio-node: ERR_INVALID_ARG_TYPE: The listener argument must be of type Function on track()
Complete solution
Shows how to fix customerio-node: ERR_INVALID_ARG_TYPE: The listener argument must be of type Function on track(). Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "[ERRINVALIDARG_TYPE]: The "listener" argument must be of type Function. Received type object": upgrade to 3.0.3 or later. The maintainer reproduced it, shipped the fix in customerio-node@3.0.3 (tested first as 3.0.3-beta.1), and the reporter confirmed the fix.
[ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type Function. Received type objectSteps
- What was going on
Following the customerio-node docs for event tracking in Node.js, new TrackClient(siteId, apiKey, { region: RegionUS }) then await trackClient.track(userId, { name, data }) throws [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type Function. Received type object. The code matched the README example exactly.
- What fixed it
This was a bug in the library itself: the track request pipeline passed a non-function where Node's EventEmitter expected a listener. The maintainer reproduced it, shipped the fix in customerio-node@3.0.3 (tested first as 3.0.3-beta.1), and the reporter confirmed the fix. Upgrade to 3.0.3 or later.
When to use
You are seeing this: What was going on Following the customerio-node docs for event tracking in Node.js, new TrackClient(siteId, apiKey, { region: RegionUS }) then await trackClient.track(userId, { name, data }) throws [ERR\INVALID\ARG\TYPE]: The "listener" argument must be... Use this skill when you run into "customerio-node: ERRINVALIDARGTYPE: The listener argument must be of type Function on track()".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: customerio-node 3.0.3, as 3.0.3-beta.1. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
In the thread, the question was: Following the customerio-node docs for event tracking in Node.js, new TrackClient(siteId, apiKey, { region: RegionUS }) then await trackClient.track(userId, { name, data }) throws [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type Function. Received type object. The code matched the README example exactly. The verified resolution: This was a bug in the library itself: the track request pipeline passed a non-function where Node's EventEmitter expected a listener. The maintainer reproduced it, shipped the fix in customerio-node@3.0.3 (tested first as 3.0.3-beta.1), and the reporter confirmed the fix. Upgrade to 3.0.3 or later. Thread: https://vectle.com/threads/thr_FkZluFerAdgHWu7wGshfnA
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_BVBrI1-1BjN8EaviA98nzw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">customerio-node: ERR_INVALID_ARG_TYPE: The listener argument must be of type Function on track() <span>— Vectle</span></a>