# APM nodejs agent Errors not Showing in Kibana

**URL:** <https://discuss.elastic.co/t/apm-nodejs-agent-errors-not-showing-in-kibana/287332>\
**Category:** APM\
**Tags:** nodejs\
**Created:** [October 21, 2021, 3:03pm UTC](https://discuss.elastic.co/t/apm-nodejs-agent-errors-not-showing-in-kibana/287332 "2021-10-21T15:03:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vamshi31](https://avatars.discourse-cdn.com/v4/letter/v/ed655f/32.png) [@vamshi31](https://discuss.elastic.co/u/vamshi31)\
**Post date:** [October 21, 2021, 3:03pm UTC](https://discuss.elastic.co/t/apm-nodejs-agent-errors-not-showing-in-kibana/287332/1 "2021-10-21T15:03:09Z")

</div>

// Add this to the VERY top of the first file loaded in your app  
var apm = require('elastic-apm-node').start({  
// Override service name from package.json  
// Allowed characters: a-z, A-Z, 0-9, -, \_, and space  
serviceName: 'name',

// Use if APM Server requires a token  
secretToken: '',

// Set custom APM Server URL (default: [http://localhost:8200](http://localhost:8200))  
serverUrl: '[http://ip:8200](http://ip:8200)'  
})

I am adding this at the top of the file. metrics are showing but errors are not showing.  
Thanks

---

<div class="post-metadata">

**Author:** ![riferrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/riferrei/32/104867_2.png) [@riferrei](https://discuss.elastic.co/u/riferrei)\
**Post date:** [October 21, 2021, 6:38pm UTC](https://discuss.elastic.co/t/apm-nodejs-agent-errors-not-showing-in-kibana/287332/2 "2021-10-21T18:38:11Z")

</div>

You may want to check if the exceptions you're dealing with are caught or uncaught. For the latter, the property `logUncaughtExceptions` must be set. See [here](https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html#log-uncaught-exceptions).

Also, the Node.js agent also allows you to log errors using the API manually:

> **[Get started with Express | APM Node.js Agent Reference \[3.x\] | Elastic](https://www.elastic.co/guide/en/apm/agent/nodejs/current/express.html#express-error-logging)**

— @riferrei

---

<div class="post-metadata">

**Author:** ![vamshi31](https://avatars.discourse-cdn.com/v4/letter/v/ed655f/32.png) [@vamshi31](https://discuss.elastic.co/u/vamshi31)\
**Post date:** [October 22, 2021, 8:35am UTC](https://discuss.elastic.co/t/apm-nodejs-agent-errors-not-showing-in-kibana/287332/3 "2021-10-22T08:35:21Z")

</div>

@riferrei Hi, thanks for the reply  
I tried this one to add in my app file  
var err = new Error('Ups, something broke!')

apm.captureError(err)  
it is showing messages only.it is not showing when the app got errors. I want errors when the app went down and any databases issue with that app.  
thanks

---

<div class="post-metadata">

**Author:** ![riferrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/riferrei/32/104867_2.png) [@riferrei](https://discuss.elastic.co/u/riferrei)\
**Post date:** [October 25, 2021, 2:32pm UTC](https://discuss.elastic.co/t/apm-nodejs-agent-errors-not-showing-in-kibana/287332/4 "2021-10-25T14:32:52Z")

</div>

Oh, this is unfortunate. I'm sure you did this but were any errors flowing through the app to try when you tested? Also, any error from the database communication is propagated through the upper layers? I don't know much of JS architecture, but exceptions can't be caught and handled if the upper layers need to handle them. If the interaction with the database is handled by some layer that is not from the app side (such as a REST API DAO component that encapsulates the persistence logic) then you would need to propagate the transaction context using the [distributedTracingOrigins](https://www.elastic.co/guide/en/apm/agent/rum-js/5.x/distributed-tracing-guide.html) parameter.

Also important to check if your app uses some of the compatible frameworks with RUM:

> **[Framework-specific integrations | APM Real User Monitoring JavaScript Agent...](https://www.elastic.co/guide/en/apm/agent/rum-js/5.x/framework-integrations.html)**

— @riferrei

---

<div class="post-metadata">

**Author:** ![trentm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/trentm/32/77647_2.png) [@trentm](https://discuss.elastic.co/u/trentm)\
**Post date:** [October 25, 2021, 4:04pm UTC](https://discuss.elastic.co/t/apm-nodejs-agent-errors-not-showing-in-kibana/287332/5 "2021-10-25T16:04:51Z")

</div>

> [@vamshi31](#):
>
> it is not showing when the app got errors. I want errors when the app went down and any databases issue with that app.

@vamshi31 Hi! I work on the node.js APM agent. Are you able to show an example of an error that isn't being caught?

---

<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:** [November 15, 2021, 12:05pm UTC](https://discuss.elastic.co/t/apm-nodejs-agent-errors-not-showing-in-kibana/287332/6 "2021-11-15T12:05:45Z")

</div>

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