# Python flask agent - nfailed to submit message

**URL:** <https://discuss.elastic.co/t/python-flask-agent-nfailed-to-submit-message/156686>\
**Category:** APM\
**Created:** [November 14, 2018, 2:00pm UTC](https://discuss.elastic.co/t/python-flask-agent-nfailed-to-submit-message/156686 "2018-11-14T14:00:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebasd44](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@sebasd44](https://discuss.elastic.co/u/sebasd44)\
**Post date:** [November 14, 2018, 2:00pm UTC](https://discuss.elastic.co/t/python-flask-agent-nfailed-to-submit-message/156686/1 "2018-11-14T14:00:54Z")

</div>

Hello all,

i installed the apm server and runing

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/d/4d33afd935dcd0b576874b2bea92e28a1ff09e4f.png)

after using a flask app only for testing the apm agent  
i'm getting an error from the agent perspective

Connection to APM Server timed out (url: [http://X.X.X.X:8200/v1/errors](http://X.X.X.X:8200/v1/errors), timeout: None seconds)  
Failed to submit message: ''  
Connection to APM Server timed out (url: [http://X.X.X.X:8200/v1/transactions](http://X.X.X.X:8200/v1/transactions), timeout: None seconds)  
Failed to submit message: ''

in the app view, i'm not using a token in the apm

# configure to use ELASTIC\_APM in your application's settings from elasticapm.contrib.flask import ElasticAPM

app.config['ELASTIC\_APM'] = {  
# allowed app\_name chars: a-z, A-Z, 0-9, -, \_, and space from elasticapm.contrib.flask  
'APP\_NAME': 'yourApplicationName',  
#'SECRET\_TOKEN': 'yourToken', #if you set on the APM server configuration  
'SERVER\_URL': '[http://X.X.X.X:8200](http://X.X.X.X:8200)' # your APM server url  
}

the status in the apm server of firewalld is stopped

so how can i debug this event to see the real cause that the apm server is not receiving the message from the agent?  
please can you help me with this?

---

<div class="post-metadata">

**Author:** ![sebasd44](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@sebasd44](https://discuss.elastic.co/u/sebasd44)\
**Post date:** [November 14, 2018, 3:17pm UTC](https://discuss.elastic.co/t/python-flask-agent-nfailed-to-submit-message/156686/2 "2018-11-14T15:17:59Z")

</div>

it was running the the loopback, u changed it to 0.0.0.0 in the apm-server options to run it  
thanks!!

but right now i have this error http400 - Problem Validation JSON Document  
expected string, but got nul

do i have to change a setting in the .yaml of the server??

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/4/a47fa5073fc299aa08d556a7c37e55385d9f9f7a.png)

---

<div class="post-metadata">

**Author:** ![beniwohli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/beniwohli/32/21256_2.png) [@beniwohli](https://discuss.elastic.co/u/beniwohli)\
**Post date:** [November 14, 2018, 4:36pm UTC](https://discuss.elastic.co/t/python-flask-agent-nfailed-to-submit-message/156686/3 "2018-11-14T16:36:58Z")

</div>

Hi @sebasd44

judging from the schema validation error, you need to set a `service_name` for your Flask app, either by setting an `ELASTIC_APM_SERVICE_NAME` environment variable, or by configuring the `ElasticAPM` object directly as shown in our [Flask docs](https://www.elastic.co/guide/en/apm/agent/python/current/flask-support.html#flask-setup).

---

<div class="post-metadata">

**Author:** ![sebasd44](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@sebasd44](https://discuss.elastic.co/u/sebasd44)\
**Post date:** [November 14, 2018, 5:45pm UTC](https://discuss.elastic.co/t/python-flask-agent-nfailed-to-submit-message/156686/4 "2018-11-14T17:45:56Z")

</div>

Thanks a lot mate, that was the missing part! you were extremely helpful!

![image](https://us1.discourse-cdn.com/elastic/original/3X/f/3/f360fbe5ab894a0817b3e365e889b72b72157a46.png)

---

<div class="post-metadata">

**Author:** ![beniwohli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/beniwohli/32/21256_2.png) [@beniwohli](https://discuss.elastic.co/u/beniwohli)\
**Post date:** [November 14, 2018, 6:06pm UTC](https://discuss.elastic.co/t/python-flask-agent-nfailed-to-submit-message/156686/5 "2018-11-14T18:06:38Z")

</div>

Awesome! I will look into how we can make the experience a bit better when the service name isn't set (we should print a proper warning instead of the somewhat cryptic schema validation).

Let us know if you hit any other problems!

---

<div class="post-metadata">

**Author:** ![sebasd44](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@sebasd44](https://discuss.elastic.co/u/sebasd44)\
**Post date:** [November 14, 2018, 6:56pm UTC](https://discuss.elastic.co/t/python-flask-agent-nfailed-to-submit-message/156686/6 "2018-11-14T18:56:14Z")

</div>

Excellent, thanks a lot for your help!!  
very criptic schema validation! hahaha  
have a good day Beniwohli  
Best Regards

---

<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 5, 2018, 2:56pm UTC](https://discuss.elastic.co/t/python-flask-agent-nfailed-to-submit-message/156686/7 "2018-12-05T14:56:33Z")

</div>

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