Closed tusharsdesai closed 2 years ago
I've seen this error happen on endpoints that take an id. e.g. GET, PUT, DELETE on /v1/movies/{id}
I am seeing this panic (seems to be related to gin). Since this issue is about routing (method not allowed error), I'm reporting the panic here.
01:28:03 $ docker logs moviedb_apigateway_1
Parsing configuration file: /etc/krakend/krakend.json
req-modifier plugin loaded
[KRAKEND] 2022/04/07 - 07:56:30.192 ▶ INFO [SERVICE: Modifier Plugin] Total plugins loaded: 1
[KRAKEND] 2022/04/07 - 07:56:30.192 ▶ INFO Starting the KrakenD instance
panic: runtime error: index out of range [1] with length 1
goroutine 26 [running]:
github.com/gin-gonic/gin.(*node).addRoute(0xc0001701c0, {0xc0004a1220, 0xb}, {0xc00000e210, 0x3, 0x3})
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/tree.go:186 +0xc77
github.com/gin-gonic/gin.(*Engine).addRoute(0xc0001031e0, {0x2459cb0, 0xc0004a16b0}, {0xc0004a1220, 0xb}, {0xc00000e210, 0x3, 0x3})
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/gin.go:305 +0x1fa
github.com/gin-gonic/gin.(*RouterGroup).handle(0xc00086b7c0, {0x2459cb0, 0x3}, {0xc0004a16b0, 0x0}, {0xc000b48048, 0x1, 0x0})
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/routergroup.go:75 +0x145
github.com/gin-gonic/gin.(*RouterGroup).GET(...)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/routergroup.go:103
github.com/luraproject/lura/v2/router/gin.ginRouter.registerKrakendEndpoint({{0xc0001031e0, {0x0, 0x0, 0x0}, 0xc00073a280, {0x2a64f00, 0xc0005bfdd0}, {0x2a9bfb0, 0xc0005bf140}, 0xc00073a320}, ...}, ...)
/go/pkg/mod/github.com/luraproject/lura/v2@v2.0.1/router/gin/router.go:185 +0x265
github.com/luraproject/lura/v2/router/gin.ginRouter.registerKrakendEndpoints.func1()
/go/pkg/mod/github.com/luraproject/lura/v2@v2.0.1/router/gin/router.go:165 +0x1b0
golang.org/x/sync/errgroup.(*Group).Go.func1()
/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x67
created by golang.org/x/sync/errgroup.(*Group).Go
/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54 +0x92
01:29:48 $
I checked krakend.json and got a linting error for propagate_claims. But, I've specified claims propagation in krakend.json as per the example in the krakend docs. Claims propagation also seems to be working for me.
In any case, one more data point for your reference.
04:38:40 $ ./krakend.exe check -tlc krakend.json
Parsing configuration file: krakend.json
ERROR linting the configuration file: jsonschema: '/endpoints/0/extra_config/auth~1validator/propagate_claims/0' does not validate with https://www.krakend.io/schema/v3.json#/properties/endpoints/items/$ref/properties/extra_config/$ref/properties/auth~1validator/$ref/properties/propagate_claims/items/type: expected string, but got array
Hi @tusharsdesai , I'm giving you feedback only about the linting problem you pointed out in your last comment. It is a bug in the JSON schema and has been fixed: https://github.com/krakendio/krakend-schema/commit/1e153fc95e51b402dec9132b58189c9f534a99cd Thanks
the panic should be fixed by adding the flag "sequential_start":true
at the root of your configuration
Hey guys. I've stopped seeing these issues since upgrading to 2.0.1.
A few suggestions,
I don't know what sequential_start is for, but you can consider making it default/optional behavior. I like how GCP defines default (hard-coded, can't be changed), optional (can be changed) and mandatory/required (must be specified) configurations.
that was a great idea and we already included in the latest releases. thanks!
Please include a log message (at info level) to display the krakend version. It is easier for us to report issues.
the help command informs about the version, as the header included in every response the gateway is returning
Please tweet about minor releases as well. Many organizations will not upgrade directly to a major release and will wait for the subsequent minor/bugfix release.
thanks for the suggestion, I'll pass it to the team
This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.
Krakend intermittently returns Method Not Allowed (405) error. The error started showing up (about 1 in 5 tries) after I moved the computation of the authorization header out of the critical path in the request modifier plugin (code below).
Setup: req-modifier plugin (similar to the sample) and KeyCloak, running in docker-compose on Ubuntu 20.04
Request modifier plugin code: