-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
sumologic-go-sdk/service/cip/api_metrics_query_RunMetricsQueries.go
Lines 87 to 94 in a9a5957
| } else if localVarHttpResponse.StatusCode >= 400 { | |
| var v types.ErrorResponse | |
| err = a.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) | |
| if err != nil { | |
| newErr.error = err.Error() | |
| return localVarReturnValue, localVarHttpResponse, newErr | |
| } | |
| if v.Errors[0].Meta.Reason != "" { |
- The panic occurred on line 94, specifically when it tries to access
Errors[0]without checking the length of theErrorsslice - In our
go.mod:github.com/SumoLogic-Labs/sumologic-go-sdk/service/cip v1.2.0
I tried querying for the first time and read the documentation in the Getting Started guide. I didn't realize that the region code was case sensitive, so I put in us1 instead of US1, which caused the panic.
runtime error: index out of range [0] with length 0
runtime/debug.Stack()
runtime/debug/stack.go:24 +0x5e
runtime/panic.go:770 +0x132
github.com/SumoLogic-Labs/sumologic-go-sdk/service/cip.(*APIClient).RunMetricsQueries(0xc0007e56e0, {{0xc00030e050, 0x1, 0x1}, 0xc0010a6140})
github.com/SumoLogic-Labs/sumologic-go-sdk/service/cip@v1.2.0/api_metrics_query_RunMetricsQueries.go:94 +0xb0fThe panic went away once I put in US1 instead.
This was extremely hard to debug because the panic made me think the issue was not an environment variable. 😅
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels