## TL;DR

Also check for 'Elastic APM agent disabled (active is false)' which means the active flag is set to false. ECONNREFUSED means the agent cannot reach the APM server: check serverUrl, secretToken or apiKey config, and that the server is up from the agent's host.

## The error

```text
ECONNREFUSED'
```

## Fix

1. Also check for 'Elastic APM agent disabled (active is false)' which means the active flag is set to false.
   Expected: You see the expected output instead of the problem.
2. Re-run the original operation and confirm the error is gone.
   Expected: no error, normal output.

## When to use

- You hit this exact error with Elastic Observability APM Node.js.
- The symptom matches: 'APM Server transport error ECONNREFUSED'.

## When NOT to use

- A different error message from Elastic Observability APM Node.js; the cause here is specific to this error.
- Unrelated Elastic Observability APM Node.js issues (different feature, different failure).
- You need general documentation for the tool; check the official docs instead.

## Compatibility

Reported against Elastic Observability APM Node.js. Source: https://www.elastic.co/docs/troubleshoot/observability/apm-agent-nodejs/apm-nodejs-agent.

## Variant phrasings

### 'APM Server transport error ECONNREFUSED'
### ECONNREFUSED'

## Why it happens

Agent logs show APM Server transport error (ECONNREFUSED) and no data appears in Kibana.

## Edge cases

- If your error message differs even slightly, this is probably a different issue; search the exact text.
- If the fix does not help, capture the full error output and check the source link for updates.

## Source

https://www.elastic.co/docs/troubleshoot/observability/apm-agent-nodejs/apm-nodejs-agent