Skip to content

Commit e6fa06e

Browse files
committed
fix: allow multiple identify calls for device ID
1 parent cf07e34 commit e6fa06e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/logging/src/analytics-helpers.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,11 @@ export class ThrottledAnalytics implements MongoshAnalytics {
272272

273273
identify(message: AnalyticsIdentifyMessage): void {
274274
message = addTimestamp(message);
275-
if (this.currentUserId) {
276-
throw new Error('Identify can only be called once per user session');
275+
276+
if (this.currentUserId && !message.deviceId) {
277+
throw new Error(
278+
'Identifying without device ID can only be called once per user session'
279+
);
277280
}
278281
this.currentUserId = message.userId ?? message.anonymousId;
279282
this.restorePromise = this.restoreThrottleState().then((enabled) => {

0 commit comments

Comments
 (0)