# Unable to get RUM Agent working

**URL:** <https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950>\
**Category:** Elastic Training\
**Created:** [May 22, 2024, 3:12am UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950 "2024-05-22T03:12:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric-Domeier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric-domeier/32/125768_2.png) [@Eric-Domeier](https://discuss.elastic.co/u/Eric-Domeier)\
**Post date:** [May 22, 2024, 3:12am UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/1 "2024-05-22T03:12:38Z")

</div>

Course: Elastic Observability  
Version: 8.2.3  
Question:

When attempting to follow section 3.4, I am unable to get the RUM agent to work properly, step 11 "You should see petclinic-react" appear in services, but it never appears.

I see the following errors in the petclinic-client container

```auto
GET /api/error 404 34.263 ms - 123
Sending error to Elastic APM { id: '14c1dc243e7810bf481592a973072460' }
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"
APM Server transport error (403): Unexpected APM Server response
Error: unauthorized: anonymous access not permitted for agent "nodejs"

```

So looking at fleet server APM Integration i notice the "nodejs" agent is not in the authorized anonymous access, so i add it

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

Still no luck.

Any ideas?

---

<div class="post-metadata">

**Author:** ![Andre\_Murbach\_Maidl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_murbach_maidl/32/83508_2.png) [@Andre\_Murbach\_Maidl](https://discuss.elastic.co/u/Andre_Murbach_Maidl)\
**Post date:** [May 22, 2024, 1:55pm UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/2 "2024-05-22T13:55:07Z")

</div>

Hi @Eric-Domeier ,

you actually have two different agents based on JavaScript: one is the node agent for the backend and another is the RUM agent for the frontend. You are not required to change the settings in the APM integration, besides setting the secret token.

Can you please share the content of your `config.js` file for the `petclinic-client` container? Perhaps you have a misconfiguration over there.

Best,  
Andre

---

<div class="post-metadata">

**Author:** ![Eric-Domeier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric-domeier/32/125768_2.png) [@Eric-Domeier](https://discuss.elastic.co/u/Eric-Domeier)\
**Post date:** [May 23, 2024, 2:54pm UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/3 "2024-05-23T14:54:06Z")

</div>

Hi Andre,

Here is the current config

```auto
var config = {
  apm_server: process.env.ELASTIC_APM_SERVER_URL || 'http://fleet-server:8200',
  apm_server_token: process.env.ELASTIC_APM_SECRET_TOKEN || 'nonprodpwd',
  apm_server_js: process.env.ELASTIC_APM_SERVER_JS_URL || 'http://wxly.....pjpnh.labs.strigo.io:8200',
  apm_service_name: process.env.ELASTIC_APM_SERVICE_NAME || 'petclinic-node',
  apm_client_service_name: process.env.ELASTIC_APM_CLIENT_SERVICE_NAME || 'petclinic-react',
  apm_service_version: process.env.ELASTIC_APM_SERVICE_VERSION || '1.0.0',
  api_server: process.env.API_SERVER || 'http://petclinic-server:8000',
  api_prefix: process.env.API_PREFIX || '/petclinic/api',
  address_server: process.env.ADDRESS_SERVER || 'http://address-finder:5000',
  distributedTracingOrigins: process.env.DISTRIBUTED_TRACINGS_ORIGINS || 'http://petclinic-client:4000,http://petclinic-server:8000,http://localhost:4000,http://localhost:8080,http://localhost:8081'
}

module.exports = config;

```

I also tried it without the module.exports = config;

same result.

---

<div class="post-metadata">

**Author:** ![Andre\_Murbach\_Maidl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_murbach_maidl/32/83508_2.png) [@Andre\_Murbach\_Maidl](https://discuss.elastic.co/u/Andre_Murbach_Maidl)\
**Post date:** [May 23, 2024, 3:17pm UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/4 "2024-05-23T15:17:48Z")

</div>

> [@Eric-Domeier](#):
>
> `wxly.....pjpnh`

Is it just shortened here? Do you have the full URL setup in the config file?

Also, can you please share the result of running `docker logs petclinic-client` ?

Best,  
Andre

---

<div class="post-metadata">

**Author:** ![Eric-Domeier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric-domeier/32/125768_2.png) [@Eric-Domeier](https://discuss.elastic.co/u/Eric-Domeier)\
**Post date:** [May 23, 2024, 3:49pm UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/5 "2024-05-23T15:49:13Z")

</div>

Yes it's just shortened, I have the whole dynamic dns there

[petclinic-client.logs](https://1drv.ms/u/s!AsgWJE_tch5qgfY13DJQhkpXsnhz4g?e=wyeo8K)

---

<div class="post-metadata">

**Author:** ![Andre\_Murbach\_Maidl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_murbach_maidl/32/83508_2.png) [@Andre\_Murbach\_Maidl](https://discuss.elastic.co/u/Andre_Murbach_Maidl)\
**Post date:** [May 23, 2024, 9:38pm UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/6 "2024-05-23T21:38:54Z")

</div>

Have you included `secretToken: settings.apm_server_token,` to `bin/www` in the nodejs agent start for `petclinic-client` container?

It should be step 4 of Lab 3.3.

Best,  
Andre

---

<div class="post-metadata">

**Author:** ![Eric-Domeier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric-domeier/32/125768_2.png) [@Eric-Domeier](https://discuss.elastic.co/u/Eric-Domeier)\
**Post date:** [May 24, 2024, 2:36am UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/7 "2024-05-24T02:36:29Z")

</div>

Current settings

```auto
#!/usr/bin/env node
const settings = require('../config')
var apm = require('elastic-apm-node').start({
  serviceName: settings.apm_service_name,
  serviceVersion: settings.apm_service_version,
  serverUrl: settings.apm_server,
  captureBody: "all",
  secretToken: settings.apm_server_token,
  errorOnAbortedRequests: true,
  captureErrorLogStackTraces: "always",
  sourceLinesErrorAppFrames: 10,
  sourceLinesErrorLibraryFrames: 10,
  sourceLinesSpanAppFrames: 10,
  sourceLinesSpanLibraryFrames: 10,
  transactionMaxSpans: -1,
  asyncHooks: false
})

```

---

<div class="post-metadata">

**Author:** ![Andre\_Murbach\_Maidl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_murbach_maidl/32/83508_2.png) [@Andre\_Murbach\_Maidl](https://discuss.elastic.co/u/Andre_Murbach_Maidl)\
**Post date:** [May 24, 2024, 4:05pm UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/8 "2024-05-24T16:05:10Z")

</div>

That's interesting. This error looks like a problem in your nodejs agent configuration, but it looks ok. Do you see `petclinic-node` in the APM app?

Have you restarted `petclinic-client` container after setting the configurations?

Also test the RUM agent through Developer Tools Console in your browser.

Access Petclinic through `http://<DYNAMIC_DNS>:4000` and check the Console in your Developer Tools. You should see something like this if it is working:

 ![Screenshot 2024-05-24 at 12.53.55](https://us1.discourse-cdn.com/elastic/original/3X/1/7/171b9c2ba09b7426f3ef6c5e9afa975f36184f66.png)

If it is not working please share the error that might appear in the Console.

Best,  
Andre

---

<div class="post-metadata">

**Author:** ![Andre\_Murbach\_Maidl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_murbach_maidl/32/83508_2.png) [@Andre\_Murbach\_Maidl](https://discuss.elastic.co/u/Andre_Murbach_Maidl)\
**Post date:** [May 24, 2024, 4:44pm UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/9 "2024-05-24T16:44:42Z")

</div>

Hi @Eric-Domeier ,

I reproduced your settings on a fresh environment and it looks like your problem is including `nodejs` to **Allowed agents** and **Allowed services** in the APM integration. See in the screenshot below how the **Throughput** column shows `petclinic-react` went down when I configured these settings, but got back again when I removed them:

 ![Screenshot 2024-05-24 at 13.41.13](https://us1.discourse-cdn.com/elastic/original/3X/2/6/26f062a7ffe0e84afb16910c84ee57ff6edf7441.png)

Please remove these settings from you APM integration and save it. After this you should see `petclinic-react` in the APM app.

BTW, sometimes it might take a little bit to appear.

Best,  
Andre

---

<div class="post-metadata">

**Author:** ![Eric-Domeier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric-domeier/32/125768_2.png) [@Eric-Domeier](https://discuss.elastic.co/u/Eric-Domeier)\
**Post date:** [May 24, 2024, 5:18pm UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/10 "2024-05-24T17:18:53Z")

</div>

Hi @Andre_Murbach_Maidl

thanks that seems to have done the trick this time, very weird. I only added those because it wasn't working and was trying new things 🙂

---

<div class="post-metadata">

**Author:** ![Andre\_Murbach\_Maidl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_murbach_maidl/32/83508_2.png) [@Andre\_Murbach\_Maidl](https://discuss.elastic.co/u/Andre_Murbach_Maidl)\
**Post date:** [May 24, 2024, 7:09pm UTC](https://discuss.elastic.co/t/unable-to-get-rum-agent-working/359950/11 "2024-05-24T19:09:10Z")

</div>

Cool! I'm glad it worked @Eric-Domeier.

Anything please let us know.

Best,  
Andre
