amplitude / Amplitude-Node

Server-side Node.js SDK for Amplitude
MIT License
67 stars 20 forks source link

_pruneEvents(): TypeError: Cannot read property 'length' of null #67

Open dortonway opened 3 years ago

dortonway commented 3 years ago

Expected Behavior

Events have to be emitted.

Current Behavior

Some events are not sent to the Amplitude because of an error: 2020-12-08T23:15:37: TypeError: Cannot read property 'length' of null 2020-12-08T23:15:37: at /var/www/socialcomm/source/server/node_modules/@amplitude/node/src/retryHandler.ts:91:18 2020-12-08T23:15:37: at Array.forEach (<anonymous>) 2020-12-08T23:15:37: at RetryHandler._pruneEvents (/var/www/socialcomm/source/server/node_modules/@amplitude/node/src/retryHandler.ts:89:12) 2020-12-08T23:15:37: at RetryHandler.<anonymous> (/var/www/socialcomm/source/server/node_modules/@amplitude/node/src/retryHandler.ts:51:31) 2020-12-08T23:15:37: at step (/var/www/socialcomm/source/server/node_modules/tslib/tslib.js:141:27) 2020-12-08T23:15:37: at Object.next (/var/www/socialcomm/source/server/node_modules/tslib/tslib.js:122:57) 2020-12-08T23:15:37: at /var/www/socialcomm/source/server/node_modules/tslib/tslib.js:115:75 2020-12-08T23:15:37: at new Promise (<anonymous>) 2020-12-08T23:15:37: at Object.__awaiter (/var/www/socialcomm/source/server/node_modules/tslib/tslib.js:111:16) 2020-12-08T23:15:37: at RetryHandler.sendEventsWithRetry (/var/www/socialcomm/source/server/node_modules/@amplitude/node/dist/src/retryHandler.js:40:24)

jooohhn commented 3 years ago

Thanks for reporting this, we'll take a look at a fix

Amareis commented 2 years ago

For me it appears when call setUserId(null) or clearUserProperties() in latest amplitude version, rollback to 8.13.1