# ECK Fleet APM Node.JS agent logs "APM Server transport error (ECONNREFUSED): connect ECONNREFUSED 127.0.0.1:8200"

**URL:** <https://discuss.elastic.co/t/eck-fleet-apm-node-js-agent-logs-apm-server-transport-error-econnrefused-connect-econnrefused-127-0-0-1-8200/332624>\
**Category:** APM\
**Tags:** nodejs\
**Created:** [May 5, 2023, 7:49am UTC](https://discuss.elastic.co/t/eck-fleet-apm-node-js-agent-logs-apm-server-transport-error-econnrefused-connect-econnrefused-127-0-0-1-8200/332624 "2023-05-05T07:49:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![khteh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khteh/32/147573_2.png) [@khteh](https://discuss.elastic.co/u/khteh)\
**Post date:** [May 5, 2023, 7:49am UTC](https://discuss.elastic.co/t/eck-fleet-apm-node-js-agent-logs-apm-server-transport-error-econnrefused-connect-econnrefused-127-0-0-1-8200/332624/1 "2023-05-05T07:49:41Z")

</div>

I have installed and run ECK 8.7.1 with fleet:

```auto
$ k get agent
NAME HEALTH AVAILABLE EXPECTED VERSION AGE
elastic-agent green 6 6 8.7.1 84m
fleet-server green 3 3 8.7.1 84m

```

**Kibana version** : 8.7.1

**Elasticsearch version** : 8.7.1

**APM Server version** : 8.7.1

**APM Agent language and version** : Node.JS `"elastic-apm-node": "^3.45.0",`

**Browser version** : chrome

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:

**Fresh install or upgraded from other version?** Fresh

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
Whenever I click "Launch APM" button in Kibana, the following screen appears for a slit second and then disappears.

 ![Screenshot from 2023-05-05 15-17-15](https://us1.discourse-cdn.com/elastic/original/3X/f/d/fd7a98be0ba88b12cf9bd546bc658719ef83392c.png)

My application config:

```auto
var apm = require('elastic-apm-node').start({
  // Override service name from package.json
  // Allowed characters: a-z, A-Z, 0-9, -, _, and space
  serviceName: 'myapplication-apm',
  // Use if APM Server requires a token
  secretToken: '',
  // Use if APM Server uses API keys for authentication
  apiKey: '',
  // Set custom APM Server URL (default: http://127.0.0.1:8200)
  serverUrl: '',
  // Only activate the agent if it's running in production
  active: process.env.NODE_ENV === 'production'
})

```

My application log:

```auto
{"log.level":"error","@timestamp":"2023-05-05T07:42:34.295Z","log":{"logger":"elastic-apm-node"},"ecs":{"version":"1.6.0"},"message":"APM Server transport error (ECONNREFUSED): connect ECONNREFUSED 127.0.0.1:8200"}

```

**Steps to reproduce** :  
1.  
2.  
3.

**Errors in browser console (if relevant)**:

**Provide logs and/or server output (if relevant)**:

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [May 5, 2023, 9:24am UTC](https://discuss.elastic.co/t/eck-fleet-apm-node-js-agent-logs-apm-server-transport-error-econnrefused-connect-econnrefused-127-0-0-1-8200/332624/2 "2023-05-05T09:24:22Z")

</div>

Hi @khteh,

It looks like your APM agent is trying to connect to the default APM server URL. Can you check the address where your APM server is running and that it matches the value of the `serverUrl` property in your agent config?

---

<div class="post-metadata">

**Author:** ![khteh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khteh/32/147573_2.png) [@khteh](https://discuss.elastic.co/u/khteh)\
**Post date:** [May 7, 2023, 4:59am UTC](https://discuss.elastic.co/t/eck-fleet-apm-node-js-agent-logs-apm-server-transport-error-econnrefused-connect-econnrefused-127-0-0-1-8200/332624/3 "2023-05-07T04:59:11Z")

</div>

Resolved. Thanks.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 8, 2023, 9:02am UTC](https://discuss.elastic.co/t/eck-fleet-apm-node-js-agent-logs-apm-server-transport-error-econnrefused-connect-econnrefused-127-0-0-1-8200/332624/4 "2023-05-08T09:02:57Z")

</div>

Please share the solution in the thread, it might help someone in future 🙂

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [May 9, 2023, 11:10am UTC](https://discuss.elastic.co/t/eck-fleet-apm-node-js-agent-logs-apm-server-transport-error-econnrefused-connect-econnrefused-127-0-0-1-8200/332624/5 "2023-05-09T11:10:19Z")

</div>

I'm assuming the issue was the serverUrl wasn't specified and therefore picking up the default, so the new config would look something like the below:

```auto
var apm = require('elastic-apm-node').start({
  // Override service name from package.json
  // Allowed characters: a-z, A-Z, 0-9, -, _, and space
  serviceName: 'myapplication-apm',
  // Use if APM Server requires a token
  secretToken: '',
  // Use if APM Server uses API keys for authentication
  apiKey: '',
  // Set custom APM Server URL (default: http://127.0.0.1:8200)
  serverUrl: 'http://my-apm-server:8200',
  // Only activate the agent if it's running in production
  active: process.env.NODE_ENV === 'production'
})

```

@khteh if that's not indeed the solution do let us know!

---

<div class="post-metadata">

**Author:** ![khteh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khteh/32/147573_2.png) [@khteh](https://discuss.elastic.co/u/khteh)\
**Post date:** [May 20, 2023, 5:33am UTC](https://discuss.elastic.co/t/eck-fleet-apm-node-js-agent-logs-apm-server-transport-error-econnrefused-connect-econnrefused-127-0-0-1-8200/332624/6 "2023-05-20T05:33:44Z")

</div>

Yes, setting `serverUrl` and `verifyServerCert: false` is the solution. 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:** [June 10, 2023, 1:33am UTC](https://discuss.elastic.co/t/eck-fleet-apm-node-js-agent-logs-apm-server-transport-error-econnrefused-connect-econnrefused-127-0-0-1-8200/332624/7 "2023-06-10T01:33:53Z")

</div>

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