Closed saffari-m closed 3 years ago
@saffari-m Did you find a solution to serve a static response? I'm having the same issue and I'm running out of ideas how to solve it.
I'm not sure this is the main reason for the panic but keep in mind you can't mix no-op
with static response
@kpacha Thanks for your input. I tested the following config:
{
"version": 2,
"timeout": "3000ms",
"name": "redpanda poc",
"endpoints": [
{
"endpoint": "/redpanda",
"method": "POST",
"output_encoding": "json",
"extra_config": {
"github.com/devopsfaith/krakend/proxy": {
"static": {
"strategy": "success",
"data": {
"status": 200,
"message": "OK"
}
}
}
},
"backend": [
{
"extra_config": {
"github.com/devopsfaith/krakend-pubsub/publisher": {
"topic_url": "chat-rooms"
}
},
"host": ["kafka://"],
"disable_host_sanitize": true
}
]
}
],
"port": 8080
}
Im receiving the following exception:
2021/07/19 19:49:43 [Recovery] 2021/07/19 - 19:49:43 panic recovered:
POST /redpanda HTTP/1.1
Host: 172.17.255.200:8000
Accept: application/json
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 93
Content-Type: application/json
assignment to entry in nil map
/usr/local/go/src/runtime/map_faststr.go:204 (0xd2ccec)
/go/pkg/mod/github.com/luraproject/lura@v1.4.1/proxy/static.go:31 (0x10f0132)
/go/pkg/mod/github.com/luraproject/lura@v1.4.1/router/gin/endpoint.go:40 (0x191d611)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/context.go:165 (0x1917a79)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/recovery.go:99 (0x1917a60)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/context.go:165 (0x1916b53)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/logger.go:241 (0x1916b12)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/context.go:165 (0x190cd09)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/gin.go:489 (0x190ccef)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/gin.go:445 (0x190c7db)
/usr/local/go/src/net/http/server.go:2887 (0x10b0302)
/usr/local/go/src/net/http/server.go:1952 (0x10ab72c)
/usr/local/go/src/runtime/asm_amd64.s:1371 (0xd88e40)
Please let me know, if I should open a new issue with my comment. If you need a local environment to reproduce the exception, I can create a git repository with my local k8s setup. If it is intentional behavior, I will test it with a small lua script to manipulate the response body. Thanks in advance.
thanks for the update. I think now I got the issue in the static middleware: it is not checking if the response.Data
map is null before adding the content defined at the configuration.
the fix is quite simple, so I'm doing it in a moment and it will be available at the lura project. but I can't give you any estimates on the next krakend release date
Edit: It's weird because I found a test that should cover the scenario. I think I need some more digging before pushing any fix
@kpacha Thank you very much. Let me now if I can provide you with more information or assist you in any way.
fixed!
thanks
Thank you, for the insane fast fix!
@kpacha Thanks.
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.
Hi. I have some problems with defining the
Kafka publisher
endpoints. when I try to add a static response on Kafka endpoint, I received an exception.It's my endpoint :
Exception:
is there any idea for solving that? I can't find any examples in the documentation.