Closed Muhilraaj closed 1 year ago
@Muhilraaj Can you please attach the error details? 0.3.6 has no changes related to query execution (https://github.com/Azure/azure-sdk-for-go/releases/tag/sdk%2Fdata%2Fazcosmos%2Fv0.3.6)
here it is: panic: no Host in request URL
goroutine 1 [running]: main.GetUser() C:/Users/muhil/Documents/Go Scripts/azcosmos/main.go:41 +0x616 main.main() C:/Users/muhil/Documents/Go Scripts/azcosmos/main.go:57 +0x17
here is where it is panicking queryResponse, err := queryPager.NextPage(context.Background()) if err != nil { var responseErr *azcore.ResponseError errors.As(err, &responseErr) panic(err) }
@Muhilraaj Does this repro consistently? The project has CI/CD tests that perform real requests as part of any PR and on releases, all these tests are passing.
Are you initializing the client with a valid Endpoint URL?
Also, if you revert to 0.3.5, does the issue go away?
Actually no, I tried reverting as well, it still didn't work. But also I didn't change anything with the endpoint url as well.
One more thing, I also observed similar issue with azblob data retrival , here is the code that I use
func GetLabel() { cred, _ := azblob.NewSharedKeyCredential(os.Getenv("Storage_Account_Name"), os.Getenv("Storage_Account_Key")) options := azblob.PipelineOptions{} u, _ := url.Parse(os.Getenv("BLOB_URL")) pipeline := azblob.NewPipeline(cred, options) url := azblob.NewBlobURL(*u, pipeline) ctx := context.Background() b, _ := url.Download(ctx, 0, azblob.CountToEnd, azblob.BlobAccessConditions{}, false, azblob.ClientProvidedKeyOptions{}) var label = make(map[string]interface{}) _ = json.NewDecoder(b.Body(azblob.RetryReaderOptions{})).Decode(&label) fmt.Println(label) }
In this line _ = json.NewDecoder(b.Body(azblob.RetryReaderOptions{})).Decode(&label) I am getting a no host url error. In both cases the connection went well but data read is causing issues
If reverting does not fix it, it seems this is unrelated to the 0.3.6 release.
In both cases the connection went well but data read is causing issues
How are you certain the connection went well? Are you certain the Endpoint being used on the azblob or azcosmos clients is a valid URL and that the machine can resolve the DNS?
I tried the same url and key with python, It's working fine there.
But is it the same machine? Can you run nslookup or some commandline tool with that DNS and does it work? If using the older library version faces the same problem then something else must have changed, the library code did not. Either some configuration is setting the wrong values or the machine cannot resolve the DNS records.
The panic seems to be coming from:
For azcosmos, the URL is exactly what you put when you call NewClient
:
So it probably means the endpoint
might be an empty string? Have you tried logging that value to see what it is?
Sorry, my bad, the issue is on my end. I use a middleware code to get endpoint url and it's causing issue.
We can close this issue.
Bug Report
Package: github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos Version : v0.3.6 Go version : 1.20.4 Machine Config: Windows/AMD64
Issue: After updating to newer version from 0.3.5 to 0.3.6, queryPager.NextPage(context.Background()) is throwing no host in url error.
`