Elastic APM forbidden request: endpoint is disabled
I am currently going through an UI5 app of mine that I want to enhance so I can use APM for performance monitoring. While I have done this several time before, I always run into the same problem:
- I install a new version of ELK and APM on my laptop.
- I add the necessary NPM files for the backend and it works.
- I add RUM to the UI5 app and it won’t work.
As I have done the same scenario before I know why it is not working. In this blog I’ll share the needed steps to let an app with RUM send data to APM server.
Error message
The response I get from APM is that the endpoint is disabled.
{ "error": "forbidden request: endpoint is disabled" }
Browser
APM server
2019-01-11T01:01:22.507+0200 ERROR [request] beater/common_handler.go:299 error handling request {"request_id": "7be8514c-e929-4ec1-af1a-0dc037743302", "method": "GET", "URL": "/intake/v2/rum/events", "content_length": 0, "remote_address": "127.0.0.1", "user-agent": "Mozilla/5.0", "response_code": 403, "error": {"error":"forbidden request: endpoint is disabled"}}
Solution
APM configuration in Kibana contains all the information necessary: you have to enable RUM support in APM.
Go to APM server directory and edit the configuration file apm-server.yml
vim apm-server.yml
Enable RUM
To enable it, set enabled: true. The documentation contains some examples that you can use / adapt for your needs. Default settings are OK, so you only have to activate RUM.
rum: # To enable real user monitoring (RUM) support set this to true. enabled: true
Be careful to remove the # before rum and enabled. Just removing it before enabled makes enabled to a child of rum. It’s a YAML configuration file, hierarchy matters.
Save and start APM server.
Frontend app (UI5) configuration
Add RUM Javascript file and set serviceName parameter.
<script src="elastic-apm-rum.umd.min.js" crossorigin></script> <script> elasticApm.init({ serviceName: ui', serverUrl: 'http://localhost:8080/proxy/http/localhost:8200', }) </script>
Result
Calling the UI5 app, RUM is loaded and AJAX calls to events in APM server are now passed. RUM is working.
Browser
Kibana
The request is shown as Unkown, but that’s a different problem.
3 Comments
Marc · October 10, 2019 at 20:54
What is RUM??
Tobias Hofmann · October 12, 2019 at 11:58
RUM == Real User Monitoring
See also Elastic documentation for APM server and RUM:
https://www.elastic.co/guide/en/apm/server/current/rum.html
https://www.elastic.co/guide/en/apm/agent/rum-js/4.x/index.html
peng · August 3, 2022 at 04:46
good~