I’ve been stuck on an issue for quite a while and could really use some help or guidance.
Environment
- Go version:
go1.24
- Kite Connect Go SDK: latest (
v4)
- Works fine on: Local machine
- Fails on: Cloud instance (Ubuntu 22.04.5 LTS)
Problem
When using the SDK methods like GetQuote() or GenerateSession() on the cloud instance, I keep getting:
failed to fetch quotes from Kite: Error parsing response
Here’s a minimal reproducible snippet:
quotes, err := kiteClient.GetQuote(kiteSymbols...)
if err != nil {
return nil, fmt.Errorf("failed to fetch quotes from Kite: %w", err)
}
And for session generation:
userSession, err := k.kiteClient.GenerateSession(requestToken, k.config.ApiSecret)
if err != nil {
return nil, fmt.Errorf("failed to generate session with Kite: %w", err)
}
Both result in:
What's strange
When I bypass the SDK and use a manual http.Post for generating the session, it works perfectly fine on the same instance:
// Simplified manual version of GenerateSession that works
req, _ := http.NewRequest("POST", "https://api.kite.trade/session/token", requestBody)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
client := &http.Client{}
resp, _ := client.Do(req)
// ... unmarshal JSON manually — works fine
What I’ve tried
- Checked network access (curl requests work)
- Debug mode enabled — SDK returns
Error parsing response with no additional details
- Same API key/access token used on both local and instance
Question
Is the SDK expecting something in the response that could be failing silently if the format is different?
Also:
- Does the SDK use any specific Go net/http behavior or TLS config that might differ in cloud environments?
- Can we get the raw response from the SDK before it attempts JSON unmarshaling?
Any direction to help debug this would be hugely appreciated. Happy to share more logs or details as needed.
Thanks in advance!
I’ve been stuck on an issue for quite a while and could really use some help or guidance.
Environment
go1.24v4)Problem
When using the SDK methods like
GetQuote()orGenerateSession()on the cloud instance, I keep getting:Here’s a minimal reproducible snippet:
And for session generation:
Both result in:
What's strange
When I bypass the SDK and use a manual
http.Postfor generating the session, it works perfectly fine on the same instance:What I’ve tried
Error parsing responsewith no additional detailsQuestion
Is the SDK expecting something in the response that could be failing silently if the format is different?
Also:
Any direction to help debug this would be hugely appreciated. Happy to share more logs or details as needed.
Thanks in advance!