microsoft / clarity

A behavioral analytics library that uses dom mutations and user interactions to generate aggregated insights.
https://clarity.microsoft.com
MIT License
2.09k stars 208 forks source link

Cannot read properties of null (reading 'sessionId') #656

Closed SouthLink closed 1 month ago

SouthLink commented 1 month ago

If this is an issue you're seeing in https://clarity.microsoft.com please reach out to clarityms@microsoft.com with the details of your bug along with your project ID or a link to your project page.


For all other issues continue below:

Please also add all relevant labels from the list of existing ones.

Describe the bug clarity went crazy with errors on my production project (Cannot read properties of null (reading 'sessionId'))

Repro Steps This introduces the SDK

function (id) {
  (function (c, l, a, r, i, t, y) {
    c[a] =
      c[a] ||
      function () {
        (c[a].q = c[a].q || []).push(arguments);
      };
    t = l.createElement(r);
    t.async = 1;
    t.src = "https://www.clarity.ms/tag/" + i;
    y = l.getElementsByTagName(r)[0];
    y.parentNode.insertBefore(t, y);
  })(window, document, "clarity", "script", id);
}

clarity("set", xx, xx);
 gtag("get", gtagId, key, (result: any) => {
       clarity("set", ga_session_id, result);
 });

Screenshots image

Project info image

Browser info: image

ProsperBao commented 1 month ago
image

Yes, my sentry saw the same error

abhieshekumar commented 1 month ago

We are also seeing a spike for the same issue since 0955 IST

tomonari-t commented 1 month ago

We have started receiving similar errors reported by Sentry in our Rails web application as of today. It seems there are multiple types of error messages:

gvillo commented 1 month ago

same here, getting all these errors starting today @ClaritySupport

ClaritySupport commented 1 month ago

Hello,

Could you please share more details of the issue, project ID and website address along with link to the recordings having the issue to investigate further.

Thanks, Clarity Support Team Visit our docs!: https://docs.microsoft.com/en-us/clarity @.**@.> @.***

Confidentiality note: This e-mail, and any attachment to it, contains privileged and confidential information intended only for the use of the individual(s) or entity named in the e-mail. If the reader of the e-mail is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that reading it is strictly prohibited. If you have received this e-mail in error, please immediately return it to the sender and delete it from your system.

From: Gabriel Villoldo @.> Sent: Monday, August 26, 2024 8:59 AM To: microsoft/clarity @.> Cc: Microsoft Clarity Support @.>; Mention @.> Subject: Re: [microsoft/clarity] Cannot read properties of null (reading 'sessionId') (Issue #656)

same here, getting all these errors starting today @ClaritySupporthttps://github.com/ClaritySupport

- Reply to this email directly, view it on GitHubhttps://github.com/microsoft/clarity/issues/656#issuecomment-2310544194, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AW5BXQ7XMOSE6ZK52Q2E2HLZTNGDJAVCNFSM6AAAAABNDKOSW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQGU2DIMJZGQ. You are receiving this because you were mentioned.Message ID: @.**@.>>

abhieshekumar commented 1 month ago

Folks, maybe a naive question, what does this mean for the application? Does the break the user flow or simply prevents from recording analytics?

@gvillo @SouthLink if you folks are aware? Unable to reproduce the issue 🙃

ProsperBao commented 1 month ago

@abhieshekumar It currently appears that there are no issues, both users and analytics are working fine, but the number of Sentry warnings has spiked, and we don't know if it might lead to additional problems. Therefore, our temporary solution here is to temporarily stop using it. I suspect that there might be some issues with certain nodes in the service. I am unable to reproduce the problem, and all the information I have comes from Sentry warnings.

ClaritySupport commented 1 month ago

[like] Vikas Dasamaneni (HCL Technolo... reacted to your message:


From: Baby Fu @.> Sent: Monday, August 26, 2024 4:27:06 PM To: microsoft/clarity @.> Cc: Microsoft Clarity Support @.>; Mention @.> Subject: Re: [microsoft/clarity] Cannot read properties of null (reading 'sessionId') (Issue #656)

@abhieshekumarhttps://github.com/abhieshekumar It currently appears that there are no issues, both users and analytics are working fine, but the number of Sentry warnings has spiked, and we don't know if it might lead to additional problems. Therefore, our temporary solution here is to temporarily stop using it. I suspect that there might be some issues with certain nodes in the service. I am unable to reproduce the problem, and all the information I have comes from Sentry warnings.

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/clarity/issues/656#issuecomment-2310598167, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AW5BXQ3IIJHV5JANOE362T3ZTNJNVAVCNFSM6AAAAABNDKOSW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQGU4TQMJWG4. You are receiving this because you were mentioned.Message ID: @.***>

abhieshekumar commented 1 month ago

Thanks @ProsperBao

asprich-nw commented 1 month ago

@ClaritySupport We're also seeing all the same errors in sentry which were reported by @tomonari-t, and it's really noisy.

For us, it's pulled in through our use of bing bat via gtm, not sure if that helps: image

ClaritySupport commented 1 month ago

Hello,

Could you please share more details of the issue, project ID and website address along with link to the recordings having the issue to investigate further.

Thanks,

Clarity Support Team

Visit our docs!: https://docs.microsoft.com/en-us/clarity

@.**@.>

[cid:3de91a1d-949a-45a7-b8f7-10e9356dfd9e]

Confidentiality note: This e-mail, and any attachment to it, contains privileged and confidential information intended only for the use of the individual(s) or entity named in the e-mail. If the reader of the e-mail is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that reading it is strictly prohibited. If you have received this e-mail in error, please immediately return it to the sender and delete it from your system.


From: Adam Sprich @.> Sent: Monday, August 26, 2024 11:36 AM To: microsoft/clarity @.> Cc: Microsoft Clarity Support @.>; Mention @.> Subject: Re: [microsoft/clarity] Cannot read properties of null (reading 'sessionId') (Issue #656)

@ClaritySupporthttps://github.com/ClaritySupport We're also seeing all the same errors in sentry, which were reported by @tomonari-thttps://github.com/tomonari-t. It's really noisy for us.

For us, it's pulled in through our use of bing bat via gtm, not sure if that helps: image.png (view on web)https://github.com/user-attachments/assets/22644751-f83b-4064-b2b5-b17366ee6f1d

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/clarity/issues/656#issuecomment-2310826611, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AW5BXQYWEAH7V5HAAMLYLILZTNYRZAVCNFSM6AAAAABNDKOSW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQHAZDMNRRGE. You are receiving this because you were mentioned.Message ID: @.***>

ender336 commented 1 month ago

@tomonari-t @ProsperBao @gvillo @SouthLink @abhieshekumar

This seems to be a specific interaction between Sentry and Clarity, I haven't been able to reproduce it anywhere though. Couple questions to help me narrow it down:

I suspect Sentry is somehow interfering with Clarity's ability to shut down in some cases - the errors all pasted here are indicative that our metadata module has cleaned itself up but something else is still trying to access its data.

SouthLink commented 1 month ago
  • Sentry 报告的错误是否特定于浏览器或设备

We won't have seen these errors before Clarity version 0.7.45 or before we asked this question on August 25, and the errors reported by Sentry won't be specific to browsers or devices or users. A detailed distribution of browser errors can be viewed on the distribution chart, with special points in Hong Kong time: These errors appeared between 12:30 on August 25 and 6:00 a.m on August 26, after which they disappeared

image image

ProsperBao commented 1 month ago

It seems that this issue is not limited to version 0.7.45; I observed that it also occurred in version 0.7.41, albeit only once. Before August 25th, no similar problems were found, and it does not appear to be related to the browser.

image
tomonari-t commented 1 month ago

@ender336 Thank you for your replying.

My situation is same to @ProsperBao and @SouthLink. These errors appeared between 12:30 on August 25 and 6:00 a.m on August 26, after which they disappeared. So currently there is no errors.

ender336 commented 1 month ago

Thanks all, it must have been related to something our server was sending back in the /collect responses during that window. I'll focus around there. I'm going to close this issue as the issue is currently resolved - but please email clarityms@microsoft.com with your sites if it recures and include a link to this github issue so it can be routed to me quickly.

ProsperBao commented 3 weeks ago

@ender336 bro, the same problem has occurred again. my sentry is issuing crazy warnings

noboomu commented 3 weeks ago

Same. Can we reopen since it seems to be affecting multiple users? Sentry is showing the error is not handled which in many cases can break SPA. Here's the trace if it helps.

image

SouthLink commented 3 weeks ago

image This problem comes up again, crazy error reporting

ahmadalfy commented 3 weeks ago

The problem is still happening

image

cc @sherifarmazhar

davx1992 commented 3 weeks ago

Yeah, same error for me as well.

jiminikiz commented 3 weeks ago

Ditto

gvillo commented 3 weeks ago

Looks like it's only happening on NextJS apps, I have a vite react app and we are not getting those errors at all. I already sent an email to clarity about this. Let's see if they fix this!

shaun-lawrie-ptml commented 3 weeks ago

Same the sdk not handling the error is bubbling up into the application using clarity and causing problems. Our app is not nextjs, just vanilla react.

ahmadalfy commented 3 weeks ago

Looks like it's only happening on NextJS apps

Nope, happening in Nuxt as well