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

[Bug] Querying URL results in an error #962

Open
jad-gha opened this issue Aug 19, 2024 · 1 comment · May be fixed by #1048
Open

[Bug] Querying URL results in an error #962

jad-gha opened this issue Aug 19, 2024 · 1 comment · May be fixed by #1048

Comments

@jad-gha
Copy link

jad-gha commented Aug 19, 2024

Describe the bug

Hello,
I'm trying to use the infinity datasource to get json data.
I'm trying to query https://gitlab.com/api/v4/personal_access_tokens for example .
Querying this API without an authorization header would get you : {"message":"401 Unauthorized"}
Although, I'm getting error="runtime error: index out of range [6] with length 6".

Steps to reproduce

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/personal_access_tokens"

image

Note: bugs will be fixed only if enough information provided to reproduce the issue

Sample Data

[
{
"id": 4,
"name": "Test Token",
"revoked": false,
"created_at": "2020-07-23T14:31:47.729Z",
"scopes": [
"api"
],
"user_id": 24,
"last_used_at": "2021-10-06T17:58:37.550Z",
"active": true,
"expires_at": null
}
]

Provide a link for sample data, or provide sample data bellow

Version Details:

  • Grafana version : 10.4.1
  • Plugin version : 2.9.5

Additional context

Add any other context about the problem here.

Error Full log :

logger=plugin.yesoreyeram-infinity-datasource t=2024-08-16T14:12:43.823784227Z level=error msg="panic triggered" error="runtime error: index out of range [6] with length 6" stack="goroutine 208 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x5e\ngithub.com/grafana/grafana-plugin-sdk-go/backend.handlePanic({0x1520300, 0xc000841440})\n\t/go/pkg/mod/github.com/grafana/[email protected]/backend/serve.go:103 +0x25\ngithub.com/grafana/grafana-plugin-sdk-go/backend.defaultGRPCMiddlewares.WithRecoveryHandler.func4.1({0x60?, 0x58?}, {0x1520300?, 0xc000841440?})\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware/[email protected]/interceptors/recovery/options.go:36 +0x27\ngithub.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/recovery.recoverFrom({0x1b9db58?, 0xc000938150?}, {0x1520300?, 0xc000841440?}, 0x43d7e9?)\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware/[email protected]/interceptors/recovery/interceptors.go:54 +0xea\ngithub.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/recovery.UnaryServerInterceptor.func1.1()\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware/[email protected]/interceptors/recovery/interceptors.go:30 +0x67\npanic({0x1520300?, 0xc000841440?})\n\t/usr/local/go/src/runtime/panic.go:770 +0x132\ngithub.com/grafana/grafana-infinity-datasource/pkg/infinity.NormalizeURL({0xc000a93710, 0x30})\n\t/drone/src/pkg/infinity/request.go:86 +0x308\ngithub.com/grafana/grafana-infinity-datasource/pkg/infinity.GetQueryURL({, }, {{0xc0006dc550, 0xe}, {0xc0006dc3f0, 0xc}, 0x0, {0xc0006dd580, 0x4}, {{0xc0000430f8, ...}, ...}, ...}, ...)\n\t/drone/src/pkg/infinity/request.go:77 +0x83b\ngithub.com/grafana/grafana-infinity-datasource/pkg/infinity.GetRequest({, }, {{0xc0006dc550, 0xe}, {0xc0006dc3f0, 0xc}, 0x0, {0xc0006dd580, 0x4}, {{0xc0000430f8, ...}, ...}, ...}, ...)\n\t/drone/src/pkg/infinity/request.go:19 +0x185\ngithub.com/grafana/grafana-infinity-datasource/pkg/infinity.(*Client).req(, {, }, {, }, {, }, {{0xc0006dc550, 0xe}, {0xc0006dc3f0, ...}, ...}, ...)\n\t/drone/src/pkg/infinity/client.go:199 +0x226\ngithub.com/grafana/grafana-infinity-datasource/pkg/infinity.(*Client).GetResults(, {_, }, {{0x2667548, 0x1}, {0xc00068fc30, 0x4}, {0xc00068fb90, 0x5}, {0xc00068fbfa, ...}, ...}, ...)\n\t/drone/src/pkg/infinity/client.go:295 +0x51c\ngithub.com/grafana/grafana-infinity-datasource/pkg/infinity.GetFrameForURLSourcesWithPostProcessing({, }, {{0x2667548, 0x1}, {0xc00068fc30, 0x4}, {0xc00068fb90, 0x5}, {0xc00068fbfa, 0x3}, ...}, ...)\n\t/drone/src/pkg/infinity/remote.go:144 +0x3b8\ngithub.com/grafana/grafana-infinity-datasource/pkg/infinity.GetFrameForURLSources({, }, {{0x2667548, 0x1}, {0xc00068fc30, 0x4}, {0xc00068fb90, 0x5}, {0xc00068fbfa, 0x3}, ...}, ...)\n\t/drone/src/pkg/infinity/remote.go:25 +0x2a8\ngithub.com/grafana/grafana-infinity-datasource/pkg/pluginhost.QueryDataQuery({, _}, {{0x2667548, 0x1}, {0xc00068fc30, 0x4}, {0xc00068fb90, 0x5}, {0xc00068fbfa, 0x3}, ...}, ...)\n\t/drone/src/pkg/pluginhost/handler_querydata.go:139 +0x1fb3\ngithub.com/grafana/grafana-infinity-datasource/pkg/pluginhost.(*DataSource).QueryData(0xc0000707d0, {0x1b9db58, 0xc000938420}, 0xc000936280)\n\t/drone/src/pkg/pluginhost/handler_querydata.go:49 +0x54b\ngithub.com/grafana/grafana-plugin-sdk-go/internal/automanagement.(*Manager).QueryData(0x1b9db58?, {0x1b9db58, 0xc000938420}, 0xc000936280)\n\t/go/pkg/mod/github.com/grafana/[email protected]/internal/automanagement/manager.go:33 +0x19e\ngithub.com/grafana/grafana-plugin-sdk-go/backend.(*dataSDKAdapter).QueryData.func1({0x1b9db58, 0xc0009383c0})\n\t/go/pkg/mod/github.com/grafana/[email protected]/backend/data_adapter.go:30 +0xb1\ngithub.com/grafana/grafana-plugin-sdk-go/backend.wrapHandler.errorWrapper.func1({0x1b9db58, 0xc0009383c0})\n\t/go/pkg/mod/github.com/grafana/[email protected]/backend/adapter_utils.go:49 +0x2b\ngithub.com/grafana/grafana-plugin-sdk-go/backend.wrapHandler.logWrapper.func2({0x1b9db58, 0xc0009383c0})\n\t/go/pkg/mod/github.com/grafana/[email protected]/backend/adapter_utils.go:123 +0x6a\ngithub.com/grafana/grafana-plugin-sdk-go/backend.metricWrapper.func2({0x1b9db58, 0xc0009383c0})\n\t/go/pkg/mod/github.com/grafana/[email protected]/backend/adapter_utils.go:76 +0x90\ngithub.com/grafana/grafana-plugin-sdk-go/backend.wrapHandler.tracingWrapper.func3({0x1b9db58, 0xc000938390})\n\t/go/pkg/mod/github.com/grafana/[email protected]/backend/adapter_utils.go:105 +0x802\ngithub.com/grafana/grafana-plugin-sdk-go/backend.wrapHandler({0x1b9db58?, 0xc000938210?}, {0x1, {0xc000b454a0, 0x1f}, {0xc00068f410, 0x5}, 0xc000af47c0, 0x0, 0xc0007b08f0, ...}, ...)\n\t/go/pkg/mod/github.com/grafana/[email protected]/backend/adapter_utils.go:33 +0x146\ngithub.com/grafana/grafana-plugin-sdk-go/backend.(*dataSDKAdapter).QueryData(0xc0007105f0, {0x1b9db58?, 0xc000938150?}, 0xc00009ac80)\n\t/go/pkg/mod/github.com/grafana/[email protected]/backend/data_adapter.go:27 +0x148\ngithub.com/grafana/grafana-plugin-sdk-go/backend/grpcplugin.(*dataGRPCServer).QueryData(0x27a7190?, {0x1b9db58?, 0xc000938150?}, 0x3?)\n\t/go/pkg/mod/github.com/grafana/[email protected]/backend/grpcplugin/grpc_data.go:48 +0x25\ngithub.com/grafana/grafana-plugin-sdk-go/genproto/pluginv2._Data_QueryData_Handler.func1({0x1b9db58?, 0xc000938150?}, {0x14f7080?, 0xc00009ac80?})\n\t/go/pkg/mod/github.com/grafana/[email protected]/genproto/pluginv2/backend_grpc.pb.go:205 +0xcb\ngithub.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/recovery.UnaryServerInterceptor.func1({0x1b9db58?, 0xc000938150?}, {0x14f7080?, 0xc00009ac80?}, 0xc000727350?, 0x15e37ac?)\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware/[email protected]/interceptors/recovery/interceptors.go:34 +0x9c\ngoogle.golang.org/grpc.getChainUnaryHandler.func1({0x1b9db58, 0xc000938150}, {0x14f7080, 0xc00009ac80})\n\t/go/pkg/mod/google.golang.org/[email protected]/server.go:1196 +0xb2\ngithub.com/grafana/grafana-plugin-sdk-go/backend.defaultGRPCMiddlewares.(*ServerMetrics).UnaryServerInterceptor.UnaryServerInterceptor.func9({0x1b9db58, 0xc000938150}, {0x14f7080, 0xc00009ac80}, 0xc000b09f60?, 0xc000af4780)\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware/[email protected]/interceptors/server.go:22 +0x28a\ngoogle.golang.org/grpc.NewServer.chainUnaryServerInterceptors.chainUnaryInterceptors.func1({0x1b9db58, 0xc000938150}, {0x14f7080, 0xc00009ac80}, 0xc000b09f60, 0x80?)\n\t/go/pkg/mod/google.golang.org/[email protected]/server.go:1187 +0x85\ngithub.com/grafana/grafana-plugin-sdk-go/genproto/pluginv2._Data_QueryData_Handler({0x13d1000, 0xc000710a60}, {0x1b9db58, 0xc000938150}, 0xc000936080, 0xc0007225a0)\n\t/go/pkg/mod/github.com/grafana/[email protected]/genproto/pluginv2/backend_grpc.pb.go:207 +0x143\ngoogle.golang.org/grpc.(*Server).processUnaryRPC(0xc00034d400, {0x1b9db58, 0xc000938060}, {0x1ba7e20, 0xc000002000}, 0xc00071d0e0, 0xc0007279e0, 0x27a7130, 0x0)\n\t/go/pkg/mod/google.golang.org/[email protected]/server.go:1379 +0xdf8\ngoogle.golang.org/grpc.(*Server).handleStream(0xc00034d400, {0x1ba7e20, 0xc000002000}, 0xc00071d0e0)\n\t/go/pkg/mod/google.golang.org/[email protected]/server.go:1790 +0xe8b\ngoogle.golang.org/grpc.(*Server).serveStreams.func2.1()\n\t/go/pkg/mod/google.golang.org/[email protected]/server.go:1029 +0x8b\ncreated by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 24\n\t/go/pkg/mod/google.golang.org/[email protected]/server.go:1040 +0x125\n"

Thank you

@f0rkth1s
Copy link

I am also having this same exact issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants