# Failed to submit message: 'Connection to APM Server timed out (url: http://apm-server:8200/intake/v2/events, timeout: 10000.0 seconds)

**URL:** <https://discuss.elastic.co/t/failed-to-submit-message-connection-to-apm-server-timed-out-url-http-apm-server-8200-intake-v2-events-timeout-10000-0-seconds/324076>\
**Category:** APM\
**Tags:** python, server\
**Created:** [January 26, 2023, 10:38pm UTC](https://discuss.elastic.co/t/failed-to-submit-message-connection-to-apm-server-timed-out-url-http-apm-server-8200-intake-v2-events-timeout-10000-0-seconds/324076 "2023-01-26T22:38:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SELENAAA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/selenaaa/32/115995_2.png) [@SELENAAA](https://discuss.elastic.co/u/SELENAAA)\
**Post date:** [January 26, 2023, 10:38pm UTC](https://discuss.elastic.co/t/failed-to-submit-message-connection-to-apm-server-timed-out-url-http-apm-server-8200-intake-v2-events-timeout-10000-0-seconds/324076/1 "2023-01-26T22:38:12Z")

</div>

**Kibana version** :

**Elasticsearch version** : elastic-apm==6.13.2

**APM Server version** :

**APM Agent language and version** : python

**Browser version** : safari

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

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

**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

1. Set up APM python agent: [Monitoring AWS Lambda Python Functions | APM Python Agent Reference [6.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/python/current/lambda-support.html)

2. Set up client instance: [API reference | APM Python Agent Reference [master] | Elastic](https://www.elastic.co/guide/en/apm/agent/python/master/api.html)

I used the above guides to set up the apm agent and client instance. But it's unable to produce the test message, instead I keep seeing the errors on my lambda logs, not sure why it's failing to connect.  
[ERROR] 2023-01-26T22:08:53.457Z cebca8fc-5197-5996-b5d6-f4b0ada5cdd8 Failed to submit message: 'Connection to APM Server timed out (url: [http://apm-server:8200/intake/v2/events](http://apm-server:8200/intake/v2/events), timeout: 10000.0 seconds)'  
and  
[ERROR] 2023-01-26T22:12:01.294Z da1a686a-16f3-5782-9b34-3426ea2dda72 dropping flushed data due to transport failure back-off

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [January 27, 2023, 10:34pm UTC](https://discuss.elastic.co/t/failed-to-submit-message-connection-to-apm-server-timed-out-url-http-apm-server-8200-intake-v2-events-timeout-10000-0-seconds/324076/2 "2023-01-27T22:34:32Z")

</div>

It appears you don't have your APM Server URL properly configured, as it's trying to send to `http://apm-server:8200`. Assuming you are using the [Elastic APM AWS Lambda Extension](https://www.elastic.co/guide/en/apm/lambda/current/aws-lambda-arch.html), you should not be setting the `ELASTIC_APM_SERVER_URL` -- the default is correct for communicating with the extension.

Instead, you should be setting these environment variables:

```auto
ELASTIC_APM_LAMBDA_APM_SERVER = <YOUR-APM-SERVER-URL> # this is your APM Server URL
ELASTIC_APM_SECRET_TOKEN = <YOUR-APM-SECRET-TOKEN> # this is your APM secret token
ELASTIC_APM_SEND_STRATEGY = background

```

Hope that helps!

---

<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:** [February 17, 2023, 6:34pm UTC](https://discuss.elastic.co/t/failed-to-submit-message-connection-to-apm-server-timed-out-url-http-apm-server-8200-intake-v2-events-timeout-10000-0-seconds/324076/3 "2023-02-17T18:34:57Z")

</div>

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