Skip to content

Error parsing response on cloud instance, works locally (Go 1.24, latest SDK) #121

Description

@Dhruv-Sachdev1313

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:

Error parsing response

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions