# Unable to reach APM Server: 'Connection aborted.' RemoteDisconnected('Remote end closed connection without response')) (url: http://127.0.0.1:8200/intake/v2/events). (potentially caused by apm-lambda-extension/extension.handleIntakeV2Events exception)

**URL:** https://discuss.elastic.co/t/unable-to-reach-apm-server-connection-aborted-remotedisconnected-remote-end-closed-connection-without-response-url-http-127-0-0-1-8200-intake-v2-events-potentially-caused-by-apm-lambda-extension-extension-handleintakev2events-exception/347039
**Category:** APM
**Tags:** python, aws-lambda
**Created:** [November 13, 2023, 4:49pm UTC](https://discuss.elastic.co/t/unable-to-reach-apm-server-connection-aborted-remotedisconnected-remote-end-closed-connection-without-response-url-http-127-0-0-1-8200-intake-v2-events-potentially-caused-by-apm-lambda-extension-extension-handleintakev2events-exception/347039 "2023-11-13T16:49:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Anton\_Matviyenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anton_matviyenko/32/87482_2.png) [@Anton\_Matviyenko](https://discuss.elastic.co/u/Anton_Matviyenko)
#### Post date: [November 13, 2023, 4:49pm UTC](https://discuss.elastic.co/t/unable-to-reach-apm-server-connection-aborted-remotedisconnected-remote-end-closed-connection-without-response-url-http-127-0-0-1-8200-intake-v2-events-potentially-caused-by-apm-lambda-extension-extension-handleintakev2events-exception/347039/1 "2023-11-13T16:49:50Z")

</div>

Dear Elastic Team,

It looks like this issue is similar to the following:

> [@Failed to submit message (aws lambda using python)](https://discuss.elastic.co/t/failed-to-submit-message-aws-lambda-using-python/332576):
>
> Hello guys, I am using elastic in lambda, with: elastic-apm==6.14 layer:elastic-apm-extension-ver-1-3-0-x86\_64:1 python 3.9 in aws lambda I am receiving an error in some operations, most of the executions works fine, but i have some erros like this: Failed to submit message: "Unable to reach APM Server: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) Did someone resolved this error ? Thanks guys

> [@Unable to reach APM Server: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))](https://discuss.elastic.co/t/unable-to-reach-apm-server-connection-aborted-remotedisconnected-remote-end-closed-connection-without-response/166500):
>
> Kibana version: 6.6.0 Elasticsearch version: 6.6.0 APM Server version: 6.6.0 APM Agent language and version: Python Browser version: FF 65.0 Original install method (e.g. download page, yum, deb, from source, etc.) and version: apt Fresh install or upgraded from other version? Fresh install I got this issue. Does anybody know how to fix it? Failed to submit message: u"Unable to reach APM Server: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))…

We do use Python APM Elastic Agent along with Sentry and in Sentry we do see the following exceptions:

Failed to submit message: "Unable to reach APM Server: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) (url: [http://127.0.0.1:8200/intake/v2/events](http://127.0.0.1:8200/intake/v2/events))

**Elasticsearch version:** : v8.10.2

**APM Server version** : v8.10.2

**APM Agent language and version** : 6.19.0

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

1. **template.yaml Layers** : arn:aws:lambda:eu-central-1:267093732750:layer:elastic-apm-extension-ver-1-0-2-x86\_64:1
2. **pip requirements.txt** : elastic-apm==6.19.0

I enabled the ELASTIC\_APM\_LOG\_LEVEL: debug in lambda "template.yaml" and captured the logs for the failed request.

Please note that elastic apm python module is installed as layer and as a python module during lambda build (hopefully that is fine).

Right now about the behaviour - it is working fine there is no misconfigurations. The apm transaction information is being properly shipped. From time to time this exception is happening (which is related to the golang library crash - see the log). If such crash is experienced then this transaction information is not being shipped properly.

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

```auto
[DEBUG]	2023-11-13T15:55:10.826Z	some-guid-here	forced flush
{
    "log.level": "debug",
    "@timestamp": "2023-11-13T15:55:10.827Z",
    "log.origin": {
        "file.name": "extension/route_handlers.go",
        "file.line": 78
    },
    "message": "Handling APM Data Intake",
    "ecs.version": "1.6.0"
}

{
    "log.level": "debug",
    "@timestamp": "2023-11-13T15:55:10.827Z",
    "log.origin": {
        "file.name": "extension/apm_server_transport.go",
        "file.line": 238
    },
    "message": "Adding agent data to buffer to be sent to apm server",
    "ecs.version": "1.6.0"
}

2023/11/13 15:55:10 http: panic serving 127.0.0.1:43610: send on closed channel
goroutine 86 [running]:
net/http.(*conn).serve.func1()
/var/lib/jenkins/workspace/ibrary_apm-aws-lambda-mbp_v1.0.2/.gvm/versions/go1.18.2.linux.amd64/src/net/http/server.go:1825 +0xbf
panic({0x6d3840, 0x7a5990})
/var/lib/jenkins/workspace/ibrary_apm-aws-lambda-mbp_v1.0.2/.gvm/versions/go1.18.2.linux.amd64/src/runtime/panic.go:844 +0x258
elastic/apm-lambda-extension/extension.handleIntakeV2Events.func1({0x7a8b38, 0xc0001b4ee0}, 0xc000287200)
/var/lib/jenkins/workspace/ibrary_apm-aws-lambda-mbp_v1.0.2/src/github.com/elastic/apm-aws-lambda/apm-lambda-extension/extension/route_handlers.go:97 +0x497
net/http.HandlerFunc.ServeHTTP(0x70f27ac438?, {0x7a8b38?, 0xc0001b4ee0?}, 0xc0002938a0?)
/var/lib/jenkins/workspace/ibrary_apm-aws-lambda-mbp_v1.0.2/.gvm/versions/go1.18.2.linux.amd64/src/net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc0001db097?, {0x7a8b38, 0xc0001b4ee0}, 0xc000287200)
/var/lib/jenkins/workspace/ibrary_apm-aws-lambda-mbp_v1.0.2/.gvm/versions/go1.18.2.linux.amd64/src/net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0x7a7d20?}, {0x7a8b38, 0xc0001b4ee0}, 0xc000287200)
/var/lib/jenkins/workspace/ibrary_apm-aws-lambda-mbp_v1.0.2/.gvm/versions/go1.18.2.linux.amd64/src/net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc00018c000, {0x7a8d90, 0xc000074600})
/var/lib/jenkins/workspace/ibrary_apm-aws-lambda-mbp_v1.0.2/.gvm/versions/go1.18.2.linux.amd64/src/net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
/var/lib/jenkins/workspace/ibrary_apm-aws-lambda-mbp_v1.0.2/.gvm/versions/go1.18.2.linux.amd64/src/net/http/server.go:3071 +0x4db
{
    "log.level": "debug",
    "@timestamp": "2023-11-13T15:55:10.827Z",
    "log.origin": {
        "file.name": "apm-lambda-extension/main.go",
        "file.line": 125
    },
    "message": "Received event.",
    "ecs.version": "1.6.0"
}

```

Thank you for your Support!

---

<div class="post-metadata">

### Author: ![lahsivjar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lahsivjar/32/101451_2.png) [@lahsivjar](https://discuss.elastic.co/u/lahsivjar)
#### Post date: [November 14, 2023, 5:01am UTC](https://discuss.elastic.co/t/unable-to-reach-apm-server-connection-aborted-remotedisconnected-remote-end-closed-connection-without-response-url-http-127-0-0-1-8200-intake-v2-events-potentially-caused-by-apm-lambda-extension-extension-handleintakev2events-exception/347039/2 "2023-11-14T05:01:40Z")

</div>

@Anton_Matviyenko ,

Thanks for reporting the issue. I see that you are using an old version of the extension (`v1.0.2`) whereas the latest version is `v1.5.1`. There are various improvements shipped between the 2 versions. Can you try the latest version and see if the error continues to occur?

---

<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: [December 12, 2023, 5:02am UTC](https://discuss.elastic.co/t/unable-to-reach-apm-server-connection-aborted-remotedisconnected-remote-end-closed-connection-without-response-url-http-127-0-0-1-8200-intake-v2-events-potentially-caused-by-apm-lambda-extension-extension-handleintakev2events-exception/347039/3 "2023-12-12T05:02:16Z")

</div>

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