Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response could not be parsed, invalid character '<' looking for beginning of value #147

Open
madpipeline opened this issue Aug 28, 2024 · 3 comments

Comments

@madpipeline
Copy link

Receiving error:

ERRO[2024-08-28T16:08:21.337077196+03:00] Response could not be parsed, invalid character '<' looking for beginning of value
main_test.go:59: Failed to fetch OpsGenie Alerts: Response could not be parsed, invalid character '<' looking for beginning of value

when trying doing:

alertClient, err := alert.NewClient(&client.Config{
    ApiKey:         opsGenieAPIKey,
    OpsGenieAPIURL: "mycompany.app.opsgenie.com",
})
if err != nil {
    t.Logf("Failed to create OpsGenie Alert Client: %s", err.Error())
    t.FailNow()
}

t.Log("Fetching OpsGenie Alerts...")
listAlertResult, err := alertClient.List(context.Background(), &alert.ListAlertRequest{
    SearchIdentifier: queueName,
})

The documentation does not list which of the fields of ListAlertRequest are mandatory, and there is no example code on how to use the List() function properly.

@madpipeline
Copy link
Author

I get a "loading screen" html web page if I try to do the same request using curl:

curl -vvv -XGET -H "Authorization: GenieKey $opsGenieAPIKey" "https://mycompany.app.opsgenie.com/v2/alerts?searchIdentifier=$queueName"

according to the API docs for that endpoint none of the fields are mandatory, so providing just one should be valid.

@madpipeline
Copy link
Author

It seems that I was confused by the variable OpsGenieAPIURL in the Golang docs, and I've assumed that since I'm not using "the global" OpsGenie instance and I'm using a customer specific tenant, I should be using the tenant specific domain.

After some testing I found that I should be using always api.opsgenie.com or api.eu.opsgenie.com if I'm using the EU instance.

Both work in my case, so I'm unclear on the difference between the EU and non EU instance.

I'd propose that this should be clarified in the golang SDK documentation on de description of the OpsGenieAPIURL variable.

@madpipeline
Copy link
Author

There is a related Atlassian support ticket for this issue: https://support.atlassian.com/requests/OGSP-132626/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant