# ERR\_CONNECTION\_TIMED\_OUT in django template

**URL:** <https://discuss.elastic.co/t/err-connection-timed-out-in-django-template/307062>\
**Category:** APM\
**Tags:** python, rum, elastic-agent\
**Created:** [June 13, 2022, 6:39pm UTC](https://discuss.elastic.co/t/err-connection-timed-out-in-django-template/307062 "2022-06-13T18:39:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vaibhav\_Lodha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vaibhav_lodha/32/106948_2.png) [@Vaibhav\_Lodha](https://discuss.elastic.co/u/Vaibhav_Lodha)\
**Post date:** [June 13, 2022, 6:39pm UTC](https://discuss.elastic.co/t/err-connection-timed-out-in-django-template/307062/1 "2022-06-13T18:39:57Z")

</div>

**APM Agent language and version** : python, 5.7

**Browser version** : 102

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

**Steps to reproduce** :  
I am trying to track API requests and page load time on Django admin using rum, but having a very hard time setting it up.. we have a self-hosted APM server and the admin is in another instance... I have injected the code in the Django template but for some reason, requests are being timeout, and idk what can be done here to resolve this...

```auto
        <script>
          ;(function(d, s, c) {
            var j = d.createElement(s),
              t = d.getElementsByTagName(s)[0]

            j.src = 'https://cdn.jsdelivr.net/npm/@elastic/apm-rum@5.2.0/dist/bundles/elastic-apm-rum.umd.min.js'
            j.onload = function() {
                elasticApm.init(c)
            }
            t.parentNode.insertBefore(j, t)
          })(document, 'script', {
                serviceName: "admin",
                serverUrl: "{% elastic_apm_server_url %}"
            })
        </script>

```

**Errors in browser console (if relevant)**:

```auto
[Elastic APM] Failed sending events! Error: https://<private_url>:<port>/intake/v2/rum/events HTTP status: 0
    at e._constructError (apm-server.js:93:12)
    at apm-server.js:37:70

```

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

```auto
POST https://<private_url>/intake/v2/rum/events net::ERR_CONNECTION_TIMED_OUT
(anonymous) @ VM91:1
(anonymous) @ xhr-patch.js:102
U.r.<computed> @ patch-utils.js:46
(anonymous) @ apm-server.js:145
e._makeHttpRequest @ apm-server.js:104
e._postJson @ apm-server.js:55
e.sendEvents @ apm-server.js:323
(anonymous) @ apm-server.js:33
e.flush @ queue.js:34
(anonymous) @ queue.js:20
setTimeout (async)
e._setTimer @ queue.js:19
e.add @ queue.js:46
(anonymous) @ throttle.js:20
e.addTransaction @ apm-server.js:228
(anonymous) @ performance-monitoring.js:89
(anonymous) @ event-handler.js:35
e.sendOnly @ event-handler.js:33
e.send @ event-handler.js:46
(anonymous) @ transaction-service.js:251
Promise.then (async)
e.handleTransactionEnd @ transaction-service.js:217
r.onEnd @ transaction-service.js:199
e.callOnEnd @ span-base.js:75
i.end @ transaction.js:113
i.detectFinish @ transaction.js:96
i.removeTask @ transaction.js:139
e.removeTask @ transaction-service.js:351
e.processAPICalls @ performance-monitoring.js:222
(anonymous) @ performance-monitoring.js:161
(anonymous) @ event-handler.js:35
e.sendOnly @ event-handler.js:33
e.send @ event-handler.js:45
(anonymous) @ index.js:14
c @ xhr-patch.js:27
(anonymous) @ xhr-patch.js:59
setTimeout (async)
(anonymous) @ utils.js:291
u.<computed> @ xhr-patch.js:57
load (async)
u @ xhr-patch.js:73
(anonymous) @ xhr-patch.js:117
U.r.<computed> @ patch-utils.js:46
yr @ clarity.js:2
(anonymous) @ clarity.js:2
(anonymous) @ clarity.js:2
(anonymous) @ clarity.js:2
o @ clarity.js:2
Promise.then (async)
s @ clarity.js:2
(anonymous) @ clarity.js:2
Q @ clarity.js:2
br @ clarity.js:2
(anonymous) @ clarity.js:2
setTimeout (async)
D @ clarity.js:2
gr @ clarity.js:2
(anonymous) @ clarity.js:2
(anonymous) @ clarity.js:2
(anonymous) @ clarity.js:2
(anonymous) @ clarity.js:2
Q @ clarity.js:2
er @ clarity.js:2
Ie @ clarity.js:2
(anonymous) @ clarity.js:2

```

---

<div class="post-metadata">

**Author:** ![kyungeunni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kyungeunni/32/125539_2.png) [@kyungeunni](https://discuss.elastic.co/u/kyungeunni)\
**Post date:** [June 14, 2022, 10:49am UTC](https://discuss.elastic.co/t/err-connection-timed-out-in-django-template/307062/2 "2022-06-14T10:49:31Z")

</div>

Hi @Vaibhav_Lodha,

Could you share with me what version of 1. ELK stack 2. APM server you are using? We've made a few improvements and APM also had a few changes over time so it is important to understand your exact setup in order to give you the correct guidance.

Also, it seems like you are using a relatively older version of RUM agent. We recommend you to use our latest version (5.11.1 as of today) as we've made many improvements since then!

Meanwhile, in case you are using `8.x`, we recommend you to double check [integration installation](https://www.elastic.co/guide/en/apm/guide/8.2/apm-integration-upgrade-steps.html) part. We had a few cases the clients got the timeout response from APM server as the integration wasn't installed.

Thanks,  
Kyungeun

---

<div class="post-metadata">

**Author:** ![Alberto\_Delgado](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alberto_delgado/32/98488_2.png) [@Alberto\_Delgado](https://discuss.elastic.co/u/Alberto_Delgado)\
**Post date:** [June 29, 2022, 2:27pm UTC](https://discuss.elastic.co/t/err-connection-timed-out-in-django-template/307062/3 "2022-06-29T14:27:59Z")

</div>

Hi @Vaibhav_Lodha,

Have you had time to check my colleague comment?

Thanks,  
Alberto

---

<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:** [July 20, 2022, 10:28am UTC](https://discuss.elastic.co/t/err-connection-timed-out-in-django-template/307062/4 "2022-07-20T10:28:10Z")

</div>

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