# Cannot read property 'start' of null with Mongodb instrumentation crashes the app

**URL:** <https://discuss.elastic.co/t/cannot-read-property-start-of-null-with-mongodb-instrumentation-crashes-the-app/122400>\
**Category:** APM\
**Created:** [March 4, 2018, 8:39am UTC](https://discuss.elastic.co/t/cannot-read-property-start-of-null-with-mongodb-instrumentation-crashes-the-app/122400 "2018-03-04T08:39:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shimi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shimi/32/2620_2.png) [@Shimi](https://discuss.elastic.co/u/Shimi)\
**Post date:** [March 4, 2018, 8:39am UTC](https://discuss.elastic.co/t/cannot-read-property-start-of-null-with-mongodb-instrumentation-crashes-the-app/122400/1 "2018-03-04T08:39:05Z")

</div>

Exception message  
`Cannot read property 'start' of null`  
Culprit  
`wrappedFunction (node_modules/elastic-apm-node/lib/instrumentation/modules/mongodb-core.js)`

```auto
node_modules/elastic-apm-node/lib/instrumentation/modules/mongodb-core.js in wrappedFunction at line 107

105. span = agent.buildSpan()
106. arguments[0] = wrappedCallback
107. span.start(this.ns + '.' + (this.cmd.find ? 'find' : name), 'db.mongodb.query')
108. }
109. }

```

versions:  
mongodb node client 2.2.21  
mongoose 4.13.3  
node.js v8.5.0

---

<div class="post-metadata">

**Author:** ![wa7son](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wa7son/32/21259_2.png) [@wa7son](https://discuss.elastic.co/u/wa7son)\
**Post date:** [March 4, 2018, 4:30pm UTC](https://discuss.elastic.co/t/cannot-read-property-start-of-null-with-mongodb-instrumentation-crashes-the-app/122400/2 "2018-03-04T16:30:02Z")

</div>

Hi Shimi

Thanks for letting us know about this bug. I'm terribly sorry this snug into a release. I've opened [a PR](https://github.com/elastic/apm-agent-nodejs/pull/265) that fixes this, and will let you know once it's released.

Best,  
Thomas

---

<div class="post-metadata">

**Author:** ![wa7son](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wa7son/32/21259_2.png) [@wa7son](https://discuss.elastic.co/u/wa7son)\
**Post date:** [March 4, 2018, 5:27pm UTC](https://discuss.elastic.co/t/cannot-read-property-start-of-null-with-mongodb-instrumentation-crashes-the-app/122400/3 "2018-03-04T17:27:13Z")

</div>

This have now been fixed and released in v1.1.1 of the Node.js agent

---

<div class="post-metadata">

**Author:** ![Shimi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shimi/32/2620_2.png) [@Shimi](https://discuss.elastic.co/u/Shimi)\
**Post date:** [March 5, 2018, 8:00am UTC](https://discuss.elastic.co/t/cannot-read-property-start-of-null-with-mongodb-instrumentation-crashes-the-app/122400/4 "2018-03-05T08:00:54Z")

</div>

Thanks Tomas,

I tried 1.1.1 and it works now  
thanks

---

<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 26, 2018, 4:01am UTC](https://discuss.elastic.co/t/cannot-read-property-start-of-null-with-mongodb-instrumentation-crashes-the-app/122400/5 "2018-03-26T04:01:00Z")

</div>

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