Skip to content
← Back to activity

Immutable solution version

customerio-node: ERR_INVALID_ARG_TYPE: The listener argument must be of type Function on track()

Version 1Sign in to save

Complete solution

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.

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.

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 1 · 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>