GithubHelp home page GithubHelp logo

Comments (10)

Jakob3xD avatar Jakob3xD commented on July 1, 2024

Tanks for reporting this issue.
Yes, the path should be prefixed with / .

Can you please tell what you client looks like? Are you using AWS Signing or something like that, as I can not reproduce it with our integration tests and I want to adjust them so it does not happen again.

from opensearch-go.

dom192 avatar dom192 commented on July 1, 2024

Tanks for reporting this issue. Yes, the path should be prefixed with / .

Can you please tell what you client looks like? Are you using AWS Signing or something like that, as I can not reproduce it with our integration tests and I want to adjust them so it does not happen again.

Thanks for the fast response. I tried it out in a local test setup:
local Kubernetes clusters with kind using basic auth

	return v3api.NewClient(
		v3api.Config{
			Client: osV3.Config{
				Username:  config.OS_USER,
				Password:  config.OS_PASSWORD,
				Addresses: []string{config.OS_URL},

				Transport: &http.Transport{
					TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
				},
			},
		})

from opensearch-go.

Jakob3xD avatar Jakob3xD commented on July 1, 2024

Hm, weird. I can't seem to reproduce the issue with the integration test. I did the same requests and tried to modify the client address but it does not affect it. If I understand the URL lib correctly it should not matter if the leading slash is missing. I tried looking into this for a few hours but I don't want to dig through the net/http lib to much.

It there any chance you can find where this issue is exactly coming from so we can test it as I am not able to reproduce it.

from opensearch-go.

dom192 avatar dom192 commented on July 1, 2024

The error happens on the server side. are you testing against a real endpoint? When the "/" is missing the server responds with statuscode 400.

from opensearch-go.

Jakob3xD avatar Jakob3xD commented on July 1, 2024

The error happens on the server side. are you testing against a real endpoint? When the "/" is missing the server responds with statuscode 400.

I am testing against a real opensearch container. Running make cluster.build cluster.start and make test-integ.
It looks like you have a nginx in between your setup. Can you see how the requests looks like when it reaches the nginx by looking at the nginx logs?

I am still not getting where exactly the missing / is causing the 400 as it is present in the URL when sending the requests. If it was missing the request would not work at all as your-opensearch.com_search is not a valid domain.

from opensearch-go.

dom192 avatar dom192 commented on July 1, 2024

You are probably right with the nginx, but I have no access to it to see the logs. Will ask for access and come back to you soon.

from opensearch-go.

wbeckler avatar wbeckler commented on July 1, 2024

Maybe you can get the requests using the Logger functionality in the client?

from opensearch-go.

dom192 avatar dom192 commented on July 1, 2024

Thanks for the hint with the logger within the client. I tried it out and this is my result.
Result without my fix (path = "_search"):

2024-03-12T09:55:37Z POST https://myurl/_search [status:400 request:183ms] 
< <html>
< <head><title>400 Bad Request</title></head>
< <body>
< <center><h1>400 Bad Request</h1></center>
< <hr><center>nginx</center>
< </body>
< </html>

Result with my fix (path = "/_search"):

2024-03-12T09:50:32Z POST https://myurl/_search [status:200 request:1.082s]
< {"took":45,"timed_out":false,"_shards":{"total":659,"successful":659,"skipped":658,"failed":0},"hits":{"total":{"value":0,"relation":"eq"},"max_score":null,"hits":[]}}

The strange thing is, that the POST call printed out by the logger looks equal!

from opensearch-go.

dom192 avatar dom192 commented on July 1, 2024

Hi again,
today a checked with a colleague who has more rights than me ;)
We figured out , that a direct access to the opensearch service with port 9200 works fine in both ways. In the case with a NGINX Ingress between it is only working with path = "/_search". I found also in other opensearch api function that there is a leading "/". Would be great if you could fix that :)

from opensearch-go.

dblock avatar dblock commented on July 1, 2024

@dom192 want to try to make a fix yourself? start by writing a unit test that shows the problem?

from opensearch-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.