diff --git a/apps/meteor/app/livechat/server/lib/LivechatTyped.ts b/apps/meteor/app/livechat/server/lib/LivechatTyped.ts index f3189463f0a8..2387af635ee7 100644 --- a/apps/meteor/app/livechat/server/lib/LivechatTyped.ts +++ b/apps/meteor/app/livechat/server/lib/LivechatTyped.ts @@ -688,6 +688,8 @@ class LivechatClass { const livechatVisitor = await LivechatVisitors.getVisitorByToken(token, { projection: { _id: 1 } }); + visitorDataToUpdate.token = livechatVisitor?.token || token; + let existingUser = null; if (livechatVisitor) { @@ -720,8 +722,6 @@ class LivechatClass { } } - visitorDataToUpdate.token = livechatVisitor?.token || token; - Livechat.logger.debug(visitorDataToUpdate); const upsertedLivechatVisitor = await LivechatVisitors.updateOneByIdOrToken(visitorDataToUpdate, {