clarity: Cannot read properties of null (reading 'sessionId')

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 13
  • Comments: 26

Most upvoted comments

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

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:

  • null is not an object (evaluating 'Qr.sessionId')
  • TypeError: Cannot read properties of null (reading 'version')
  • TypeError: null is not an object (evaluating 'yi.version')
image

Yes, my sentry saw the same error

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.

image This problem comes up again, crazy error reporting

@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.

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.

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!

@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