panic: handlers are already registered for path

210 views
Skip to first unread message

Emo Leumassi

unread,
Sep 28, 2023, 5:31:02 AM9/28/23
to KrakenD Community
{
"@comment": "Feature: GET ",
"endpoint": "/app",
"input_query_strings": [
"filter[filter_1]"
],
"method": "GET",
"backend": [
{
"url_pattern": "/app"
}
]
},
{
"@comment": "Feature: GET ",
"endpoint": "/app",
"input_query_strings": [
"filter[
filter_X ]",
"filter[
filter_Y ]",
"filter[
filter_Z ]"
],
"method": "GET",
"backend": [
{
"url_pattern": "/app"
}
]
},


the two endpoints has the same root but different requestParams. 
I got this error:

[00] panic: handlers are already registered for path '/app'
[00]
[00] goroutine 1 [running]:
[00] github.com/gin-gonic/gin.(*node).addRoute(0x2dc2136?, {0xc000c83af0, 0xb}, {0xc000a2c0a0?, 0x4, 0x4})
[00]    /go/pkg/mod/github.com/gin-gonic/g...@v1.9.1/tree.go:260 +0x734
[00] github.com/gin-gonic/gin.(*Engine).addRoute(0xc000502ea0, {0x2dc2136, 0x3}, {0xc000c83af0, 0xb}, {0xc000a2c0a0, 0x4, 0x4})
[00]    /go/pkg/mod/github.com/gin-gonic/g...@v1.9.1/gin.go:335 +0x272
[00] github.com/gin-gonic/gin.(*RouterGroup).handle(0xc0005aab80, {0x2dc2136, 0x3}, {0xc000c82ec0?, 0x0?}, {0xc00062a3a0, 0x1, 0xc000d3ec90?})
[00]    /go/pkg/mod/github.com/gin-gonic/g...@v1.9.1/routergroup.go:89 +0x145
[00] github.com/gin-gonic/gin.(*RouterGroup).GET(...)
[00]    /go/pkg/mod/github.com/gin-gonic/g...@v1.9.1/routergroup.go:117
[00] github.com/luraproject/lura/v2/router/gin.ginRouter.registerKrakendEndpoint({{0xc000502ea0, {0x0, 0x0, 0x0}, 0xc00061bba0, {0x357e580, 0xc0004b2f30}, {0x3597928, 0xc00061b7c0}, 0xc00061bbe0}, ...}, ...)
[00]    /go/pkg/mod/github.com/luraproject/lura/v...@v2.3.0/router/gin/router.go:163 +0x209
[00] github.com/luraproject/lura/v2/router/gin.ginRouter.registerKrakendEndpoints({{0xc000502ea0, {0x0, 0x0, 0x0}, 0xc00061bba0, {0x357e580, 0xc0004b2f30}, {0x3597928, 0xc00061b7c0}, 0xc00061bbe0}, ...}, ...)
[00]    /go/pkg/mod/github.com/luraproject/lura/v...@v2.3.0/router/gin/router.go:147 +0x1cd
[00] github.com/luraproject/lura/v2/router/gin.ginRouter.registerEndpointsAndMiddlewares({{0xc000502ea0, {0x0, 0x0, 0x0}, 0xc00061bba0, {0x357e580, 0xc0004b2f30}, {0x3597928, 0xc00061b7c0}, 0xc00061bbe0}, ...}, ...)
[00]    /go/pkg/mod/github.com/luraproject/lura/v...@v2.3.0/router/gin/router.go:129 +0x2b8
[00] github.com/luraproject/lura/v2/router/gin.ginRouter.Run({{0xc000502ea0, {0x0, 0x0, 0x0}, 0xc00061bba0, {0x357e580, 0xc0004b2f30}, {0x3597928, 0xc00061b7c0}, 0xc00061bbe0}, ...}, ...)
[00]    /go/pkg/mod/github.com/luraproject/lura/v...@v2.3.0/router/gin/router.go:103 +0x138
[00] github.com/krakendio/krakend-ce/v2.(*ExecutorBuilder).NewCmdExecutor.func1({{0x0, 0x0}, {0xc00061a2e0, 0x4, 0x4}, {0x0, 0x0, 0x0}, 0x110d9316ec000, 0x3a352944000, ...})
[00]    /github/workspace/executor.go:205 +0xe62
[00] github.com/krakendio/krakend-cobra/v2.runFunc(0x46bbf20?, {0x2dc4a3c?, 0x3?, 0x3?})
[00]    /go/pkg/mod/github.com/krakendio/krakend-cobra/v...@v2.2.0/run.go:24 +0x255
[00] github.com/spf13/cobra.(*Command).execute(0x46bbf20, {0xc0004b2570, 0x3, 0x3})
[00]    /go/pkg/mod/github.com/spf13/co...@v1.1.3/command.go:856 +0x663
[00] github.com/spf13/cobra.(*Command).ExecuteC(0x46bba20)
[00]    /go/pkg/mod/github.com/spf13/co...@v1.1.3/command.go:960 +0x39d
[00] github.com/spf13/cobra.(*Command).Execute(...)
[00]    /go/pkg/mod/github.com/spf13/co...@v1.1.3/command.go:897
[00] github.com/krakendio/krakend-cobra/v2.Root.Execute({{0x46bba20, {0x0, 0x0, 0x0}, 0xc0007a1310}, {0xc000be0750, 0x5, 0x5}, 0xc0007a1370}, {0x357e460, ...}, ...)
[00]    /go/pkg/mod/github.com/krakendio/krakend-cobra/v...@v2.2.0/cmd.go:129 +0xaf
[00] github.com/krakendio/krakend-cobra/v2.ExecuteRoot({0x357e460, 0xc0004b45a0}, 0x2e5b8ac?, {{0x46bba20, {0x0, 0x0, 0x0}, 0xc0007a1310}, {0xc000be0750, 0x5, ...}, ...})
[00]    /go/pkg/mod/github.com/krakendio/krakend-cobra/v...@v2.2.0/cmd.go:26 +0xa5
[00] github.com/krakendio/krakend-cobra/v2.Execute(...)
[00]    /go/pkg/mod/github.com/krakendio/krakend-cobra/v...@v2.2.0/cmd.go:21
[00] main.main()
[00]    /github/workspace/cmd/krakend-ce/main.go:60 +0x64a
[00] (error exit: exit status 2)

Albert Lombarte

unread,
Sep 28, 2023, 6:54:22 AM9/28/23
to KrakenD Community, Emo Leumassi
What you need is a single endpoint like this:

{
"@comment": "Feature: GET ",
"endpoint": "/app",
"input_query_strings": [
"filter[filter_1]"
"filter[ filter_X ]",
"filter[
filter_Y ]",
"filter[
filter_Z ]"
],
"method": "GET",
"backend": [
{
"url_pattern": "/app"
}
]


El dia dijous, 28 de setembre de 2023 a les 11:31:02 UTC+2, Emo Leumassi va escriure:

[00] github.com/krakendio/krakend-cobra/v2.ExecuteRoot({0x357e460, 0xc0004b45a0}, 0x2e5b8ac?, {{0x46bba20, {0x0, 0x0, 0x0}, 0xc0007a1310}, {0xc000be0750, 0x5, ...}, ...})
Reply all
Reply to author
Forward
0 new messages