opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.69k stars 892 forks source link

[BUG] Curl to dashboard version 2.2.1 gives {“statusCode”:500,”error”:”Internal Server Error”,”message”:”An internal server error occurred.”} with centos image #3665

Open aryannegi313 opened 1 year ago

aryannegi313 commented 1 year ago

Describe the bug Curl to dashboard version 2.2.1 gives {“statusCode”:500,”error”:”Internal Server Error”,”message”:”An internal server error occurred.”} with centos image _[“error”,“http”,“server”,“OpenSearchDashboards”],“pid”:19,“message”:“TypeError [ERR_INVALIDURL] error is also observed in the dashboard pod logs as we are using the curl to dashboard /api/status as readines and liveness.

To Reproduce Steps to reproduce the behavior:

  1. Build a docker image for OpenSearch-dashboards for use in Kubernetes env. Images are built using two distributions (centos7 and rocky8). In both cases, install the OpenSearch-dashboards rpm and required plugins etc.
  2. Run the dashboard in a dual-stack Kubernetes env ( IPv4 and IPv6)
  3. Check the endpoint /api/status on server.host to verify if the pod is up. In the case of Ipv6 env, server.host is set to :: (Ipv6) so a curl to http://:::/5601 should work fine.
  4. Run this endpoint to check for pod readiness/liveness

Expected behavior Curl run should be fine and the readiness and liveness should pass.

Observed behaviour With version 1.3.2 - that the curl works fine With version 2.2.1 - {“statusCode”:500,“error”:“Internal Server Error”,“message”:“An internal server error occurred.”} Error inside the pod logs _{“type”:“log”,“@timestamp”:“2023-03-15T06:58:59Z”,“tags”:[“error”,“http”,“server”,“OpenSearchDashboards”],“pid”:19,“message”:“TypeError [ERR_INVALID_URL]: Invalid URL: http://:::5601/api/status\n at new NodeError (internal/errors.js:322:7)\n at onParseError (internal/url.js:270:9)\n at new URL (internal/url.js:346:5)\n at Request._parseUrl (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:188:25)\n at Request.get url [as url] (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:122:21)\n at new OpenSearchDashboardsRequest (/usr/share/opensearch-dashboards/src/core/server/http/router/request.js:114:24)\n at Function.from (/usr/share/opensearch-dashboards/src/core/server/http/router/request.js:49:12)\n at interceptRequest (/usr/share/opensearch-dashboards/src/core/server/http/lifecycle/on_post_auth.js:77:67)\n at exports.Manager.execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/toolkit.js:57:29)\n at Request._invoke (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:398:55)\n at Request._lifecycle (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:371:86)\n at processTicksAndRejections (internal/process/task_queues.js:95:5)\n at Request._execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:281:9) {\n input: ‘http://:::5601/api/status’,\n code: ‘ERR_INVALIDURL’\n}”}

OpenSearch Version 2.2.1

Dashboards Version 2.2.1

Host/Environment (please complete the following information):

Additional context

Using curl with the '[' brackets also do not work with the centos image Following error is observed curl: (3) [globbing] illegal character in range specification at pos 9

ananzh commented 1 year ago

I think from our releases here there is no 2.2.1 release. Maybe that is the problem that causes the problem of ERR_INVALID_URL? TypeError [ERR_INVALID_URL] error suggests that an invalid URL is being used somewhere in the application code, possibly when making an HTTP request. This could be the cause of the 500 Internal Server Error. For example, if the application code or configuration is trying to access resources specific to version 2.2.1, which doesn't exist, it could lead to errors or issues within the application.

aryannegi313 commented 1 year ago

Hi @ananzh, there is a release version 2.2.1 defined for OpenSearch here in the changelogs https://github.com/opensearch-project/OpenSearch-Dashboards/blob/2.4/CHANGELOG.md

ananzh commented 1 year ago

Hi @ananzh, there is a release version 2.2.1 defined for OpenSearch here in the changelogs https://github.com/opensearch-project/OpenSearch-Dashboards/blob/2.4/CHANGELOG.md

My mistake. Let's go back to the initial problem. You are saying

With version 1.3.2 - that the curl works fine
With version 2.2.1 - {“statusCode”:500,“error”:“Internal Server Error”,“message”:“An internal server error occurred.”}
Error inside the pod logs

Is this 500 status error triggered when you run curl http://:::5601/api/status? I think I could help to use my local to run the same curl command. If local is fine, then there could be some configuration settings in Kubernetes that cause the issue. If local can reproduce it, then there might be some breaking changes in 2.2.1 in API.

aryannegi313 commented 1 year ago

Yes it is triggered on running the command curl http://:::5601/api/status and,were you able to reproduce it in your local setup?