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

**URL:** <https://discuss.elastic.co/t/error-typeerror-cannot-read-property-starttime-of-undefined/222725>\
**Category:** APM\
**Tags:** rum\
**Created:** [March 9, 2020, 2:14pm UTC](https://discuss.elastic.co/t/error-typeerror-cannot-read-property-starttime-of-undefined/222725 "2020-03-09T14:14:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akosanovic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akosanovic/32/58345_2.png) [@akosanovic](https://discuss.elastic.co/u/akosanovic)\
**Post date:** [March 9, 2020, 2:14pm UTC](https://discuss.elastic.co/t/error-typeerror-cannot-read-property-starttime-of-undefined/222725/1 "2020-03-09T14:14:33Z")

</div>

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`

 ![3337246f6b9d416e9652b7d43b7a308a.eu-west-1.aws.found.io_9243_app_apm (1)](https://us1.discourse-cdn.com/elastic/original/3X/3/e/3ecd83a077aa454c04038213604afb274544dd50.png)

```auto
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;",
          " }",
          ""
        ]
      }
    },

```

---

<div class="post-metadata">

**Author:** ![vigneshshanmugam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vigneshshanmugam/32/40324_2.png) [@vigneshshanmugam](https://discuss.elastic.co/u/vigneshshanmugam)\
**Post date:** [March 9, 2020, 2:30pm UTC](https://discuss.elastic.co/t/error-typeerror-cannot-read-property-starttime-of-undefined/222725/2 "2020-03-09T14:30:46Z")

</div>

Hi Aleksandra,

We had a [bug](https://github.com/elastic/apm-agent-rum-js/issues/680) on using capturing the First Contentful Paint, which is already fixed and releases in version [`4.9.1`](https://github.com/elastic/apm-agent-rum-js/blob/master/CHANGELOG.asciidoc#491-2020-03-09) . Could you please upgrade the agent and let us know if you are seeing this issue still?

Thanks,  
Vignesh

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 30, 2020, 10:30am UTC](https://discuss.elastic.co/t/error-typeerror-cannot-read-property-starttime-of-undefined/222725/3 "2020-03-30T10:30:47Z")

</div>

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