OpenSearch-Dashboards icon indicating copy to clipboard operation
OpenSearch-Dashboards copied to clipboard

[BUG] Misleading Permission error is displayed when new data source is created

Open lukas-vlcek opened this issue 5 months ago • 1 comments
trafficstars

Describe the bug

When a new valid Prometheus data source is created then the web UI is pointed to invalid URI which yields misleading permission warning being displayed.

Consider docker-compose configuration without security from https://github.com/opensearch-project/OpenSearch-Dashboards/issues/9915

# Previous docker cleanup:
# docker rm `docker ps -a -q`
# docker volume rm `docker volume ls -q`
docker-compose -f docker-compose-no-security.yml up

Once all services are up access Dashbaords at http://localhost:5601 and navigate to Manage -> Data sources -> Create direct query connection and select Prometheus.

Fill in the form (notice valid Prometheus URI http://localhost:9090):

Image

When new data source is created the web UI is pointed to invalid URI:

http://localhost:5601/app/management/opensearch-dashboards/dataSources/manage/manage/Prometheus
                                                                       ^______^

The problem with this URI is that the /manage part is present twice.

This leads to background error:

opensearch-dashboards  | Issue in fetching data connection: StatusCodeError: Not Found
opensearch-dashboards  |     at respond (/usr/share/opensearch-dashboards/node_modules/elasticsearch/src/lib/transport.js:349:15)
opensearch-dashboards  |     at checkRespForFailure (/usr/share/opensearch-dashboards/node_modules/elasticsearch/src/lib/transport.js:306:7)
opensearch-dashboards  |     at HttpConnector.<anonymous> (/usr/share/opensearch-dashboards/node_modules/elasticsearch/src/lib/connectors/http.js:173:7)
opensearch-dashboards  |     at IncomingMessage.wrapper (/usr/share/opensearch-dashboards/node_modules/lodash/lodash.js:4991:19)
opensearch-dashboards  |     at IncomingMessage.emit (node:events:529:35)
opensearch-dashboards  |     at IncomingMessage.emit (node:domain:489:12)
opensearch-dashboards  |     at endReadableNT (node:internal/streams/readable:1400:12)
opensearch-dashboards  |     at processTicksAndRejections (node:internal/process/task_queues:82:21) {
opensearch-dashboards  |   status: 404,
opensearch-dashboards  |   displayName: 'NotFound',
opensearch-dashboards  |   path: '/_plugins/_query/_datasources/manage',
opensearch-dashboards  |   query: {},
opensearch-dashboards  |   body: '{\n' +
opensearch-dashboards  |     '  "status": 404,\n' +
opensearch-dashboards  |     '  "error": {\n' +
opensearch-dashboards  |     '    "type": "DataSourceNotFoundException",\n' +
opensearch-dashboards  |     '    "reason": "There was internal problem at backend",\n' +
opensearch-dashboards  |     '    "details": "DataSource with name manage doesn\\u0027t exist."\n' +
opensearch-dashboards  |     '  }\n' +
opensearch-dashboards  |     '}',
opensearch-dashboards  |   statusCode: 404,
opensearch-dashboards  |   response: '{\n' +
opensearch-dashboards  |     '  "status": 404,\n' +
opensearch-dashboards  |     '  "error": {\n' +
opensearch-dashboards  |     '    "type": "DataSourceNotFoundException",\n' +
opensearch-dashboards  |     '    "reason": "There was internal problem at backend",\n' +
opensearch-dashboards  |     '    "details": "DataSource with name manage doesn\\u0027t exist."\n' +
opensearch-dashboards  |     '  }\n' +
opensearch-dashboards  |     '}',
opensearch-dashboards  |   toString: [Function (anonymous)],
opensearch-dashboards  |   toJSON: [Function (anonymous)]
opensearch-dashboards  | }

And in the web UI it yields the following message (it can take couple of seconds to be redirected here):

Image

Which is misleading because no security is configured in this setup (but it will reproduce with the security setup as well – which is even more misleading).

Click on the Data sources in the left-hand list

Image

Select the only Prometheus data-source and go for "Query data"

Image

Then select Prometheus in the Metrics source drop-down list and many metrics will be pulled in the Available Metrics list, which is expected.

Image

Expected behavior A clear and concise description of what you expected to happen.

A valid URI should be navigated when a valid Prometheus data source is created. Doubled /manage URI part should be fixed.

OpenSearch Version Tested with 2.17.1, 2.19.2 and 3.0.0.

Dashboards Version Tested with 2.17.1, 2.19.2 and 3.0.0.

Plugins

OOTB, see docker-compose files.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Browser and version [e.g. 22]

Additional context

Add any other context about the problem here.

lukas-vlcek avatar Jun 17 '25 20:06 lukas-vlcek