Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Vitals GetCLS - failing with Cannot read properties of undefined (reading 'startTime') #6087

Closed
3 tasks done
doutatsu opened this issue Oct 29, 2022 · 2 comments
Closed
3 tasks done

Comments

@doutatsu
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/vue

SDK Version

7.17.2

Framework Version

Vue 3.2.40

Link to Sentry event

https://sentry.io/organizations/studio-shogun/issues/3705072282

Steps to Reproduce

Unable to reproduce this issue - it looks to be happening on it's own, coming from the web-vitals dependency. Going by the error message, it must be this part of the code, I presume with session entries being undefined:

  const handleEntries = (entries: LayoutShift[]): void => {
    entries.forEach(entry => {
      // Only count layout shifts without recent user input.
      if (!entry.hadRecentInput) {
        const firstSessionEntry = sessionEntries[0];
        const lastSessionEntry = sessionEntries[sessionEntries.length - 1];

        // If the entry occurred less than 1 second after the previous entry and
        // less than 5 seconds after the first entry in the session, include the
        // entry in the current session. Otherwise, start a new session.
        if (
          sessionValue &&
          entry.startTime - lastSessionEntry.startTime < 1000 &&
          entry.startTime - firstSessionEntry.startTime < 5000
        ) {
          sessionValue += entry.value;
          sessionEntries.push(entry);
        } else {
          sessionValue = entry.value;
          sessionEntries = [entry];
        }

        // If the current session value is larger than the current CLS value,
        // update CLS and the entries contributing to it.
        if (sessionValue > metric.value) {
          metric.value = sessionValue;
          metric.entries = sessionEntries;
          if (report) {
            report();
          }
        }
      }
    });
  };

Expected Result

I shouldn't be getting an error from this library

Actual Result

image
image

@AbhiPrasad
Copy link
Member

Hey thanks for writing in. This is a duplicate of #6083, so going to close this issue as a result.

@AbhiPrasad AbhiPrasad closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2022
@doutatsu
Copy link
Author

doutatsu commented Oct 29, 2022

Thanks - I've tried searching, but somehow missed the existing one still. Apologies about that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants