Kong / go-pdk

Write Kong plugins in Go! 🦍
https://pkg.go.dev/github.com/Kong/go-pdk
Apache License 2.0
146 stars 50 forks source link

Response.ExitStatus causes 500 in kong: plugin_servers/pb_rpc.lua:45: attempt to index local 'v' (a nil value) #83

Closed diefans closed 2 years ago

diefans commented 2 years ago

If I use ExitStatus(http.StatusFound) I get a 500 and

plugin_servers/pb_rpc.lua:45: attempt to index local 'v' (a nil value)

If I use Exit(http.StatusFound, "", nil) everything is ok.

While inspecting the code, I would guess from the lua error, that the rpc call is missing some values. IMHO I would just call Exit from ExitStatus with empty values for body and headers

Also setting the headers in Exit seems not to work - I had to use SetHeader to create a "working" 302.

diefans commented 2 years ago

my kong version is 2.7.0

javierguerragiraldez commented 2 years ago

thanks for the report, will try to reproduce