Error: TypeError: Cannot read property 'startTime' of undefined

I need help with the error I'm getting: TypeError: Cannot read property 'startTime' of undefined.
I'm not able to reproduce it in local dev but it occurs often for live env. Do you have any suggestion how to debug this? Thank you

Kibana version: v 7.1.0

Elasticsearch version: v 7.1.0

APM Server version: v 7.1.0

APM Agent language and version: v 7.1.0

Browser version: any

Errors in browser console (if relevant): Can't reproduce in local dev

Is there anything special in your setup?

  • Angular v 5.2.0

  • @elastic/apm-rum": "^4.3.0

error.exception:  {
  "stacktrace": [
    {
      "exclude_from_grouping": false,
      "library_frame": true,
      "original": {
        "filename": "checkout/main.ebb078d15458b26f0b50.bundle.js",
        "abs_path": "https://ar.company.com/checkout/main.ebb078d15458b26f0b50.bundle.js",
        "lineno": 1,
        "colno": 303393,
        "function": "<anonymous>"
      },
      "filename": "webpack:///node_modules/@elastic/apm-rum-core/dist/es/performance-monitoring/capture-navigation.js",
      "abs_path": "https://ar.company.com/checkout/main.ebb078d15458b26f0b50.bundle.js",
      "sourcemap": {
        "updated": true
      },
      "line": {
        "number": 174,
        "column": 0,
        "context": "      var startTime = fcpEntry[0].startTime;"
      },
      "function": "getFirstContentfulPaint",
      "context": {
        "pre": [
          "      var timing = PERF.timing;",
          "      var unloadDiff = timing.fetchStart - timing.navigationStart;",
          "      var fcpEntry = entries.filter(function (entry) {",
          "        return entry.name === FIRST_CONTENTFUL_PAINT;",
          "      });"
        ],
        "post": [
          "      fcp = unloadDiff >= 0 ? startTime - unloadDiff : startTime;",
          "    }",
          "  }",
          "",
          "  return fcp;"
        ]
      }
    },
    {
      "exclude_from_grouping": false,
      "library_frame": true,
      "original": {
        "filename": "checkout/main.ebb078d15458b26f0b50.bundle.js",
        "abs_path": "https://ar.company.com/checkout/main.ebb078d15458b26f0b50.bundle.js",
        "lineno": 1,
        "colno": 303427,
        "function": "<anonymous>"
      },
      "abs_path": "https://ar.company.com/checkout/main.ebb078d15458b26f0b50.bundle.js",
      "filename": "webpack:///node_modules/@elastic/apm-rum-core/dist/es/performance-monitoring/capture-navigation.js",
      "sourcemap": {
        "updated": true
      },
      "line": {
        "number": 189,
        "column": 0,
        "context": "  var fcp = getFirstContentfulPaint();"
      },
      "function": "tr",
      "context": {
        "pre": [
          "  var agent = {",
          "    timeToFirstByte: marks.responseStart,",
          "    domInteractive: marks.domInteractive,",
          "    domComplete: marks.domComplete",
          "  };"
        ],
        "post": [
          "",
          "  if (fcp) {",
          "    agent.firstContentfulPaint = fcp;",
          "  }",
          ""
        ]
      }
    },

Hi Aleksandra,

We had a bug on using capturing the First Contentful Paint, which is already fixed and releases in version 4.9.1 . Could you please upgrade the agent and let us know if you are seeing this issue still?

Thanks,
Vignesh

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.