# Socket hang up with ExpressJS

**URL:** <https://discuss.elastic.co/t/socket-hang-up-with-expressjs/120979>\
**Category:** APM\
**Created:** [February 22, 2018, 5:19am UTC](https://discuss.elastic.co/t/socket-hang-up-with-expressjs/120979 "2018-02-22T05:19:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Huynh\_Nam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/huynh_nam/32/65965_2.png) [@Huynh\_Nam](https://discuss.elastic.co/u/Huynh_Nam)\
**Post date:** [February 22, 2018, 5:19am UTC](https://discuss.elastic.co/t/socket-hang-up-with-expressjs/120979/1 "2018-02-22T05:19:03Z")

</div>

Hi all,  
I've setup my server with `elastic-apm-node`, and it run ok. But after a period of time (30-60 min), it causes an error like below:

```auto
Error: socket hang up
    at createHangUpError (_http_client.js:331:15)
    at Socket.socketOnEnd (_http_client.js:423:23)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1055:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

```

This error made my server down too, so I need to restart it. After removed the code, everthing okay now.  
This is my config code:

```auto
require('elastic-apm-node').start({
  serviceName: '...',
  secretToken: '...',
  instrument: true,
  captureBody: 'all',
  errorOnAbortedRequests: true,
  serverUrl: 'http://...:8200',
  active: process.env.NODE_ENV === 'production'
})

```

Version

```auto
Elasticsearch, Kibana, APM v6.2.1
NodeJS v8.9.4
ExpressJS v4.15.2

```

I searched for this error, but there's no results with apm-server. Is this a known issue, or my configuration miss something? Please help me to fix this.  
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 15, 2018, 1:19am UTC](https://discuss.elastic.co/t/socket-hang-up-with-expressjs/120979/2 "2018-03-15T01:19:12Z")

</div>

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