Hi i was reading the docs and checking some things in go and i notice that you can call lua methods so, i try this:
func (conf *MyConfig) Access(kong *pdk.PDK) {
enabling, err := kong.ServiceRequest.Ask("kong.service.request.enable_buffering")
if err != nil {
kong.Log.Err(fmt.Sprint(err))
}
kong.Log.Notice("Enabling body and headers access", enabling)
}
then when i try to get the body from the response i try:
func (conf *MyConfig) Log(kong *pdk.PDK) {
res, err := kong.ServiceResponse.Ask("kong.service.request.get_raw_body")
if err != nil {
kong.Log.Err(fmt.Sprint(err))
}
kong.Log.Notice(res)
}
and this triggers me an error.
api-gateway_1 | 2020/05/21 21:35:04 [error] 32#0: *452 lua entry thread aborted: runtime error: /usr/local/share/lua/5.1/kong/pdk/private/phases.lua:73: no phase in kong.ctx.core.phase
api-gateway_1 | stack traceback:
api-gateway_1 | coroutine 0:
api-gateway_1 | [C]: in function 'error'
api-gateway_1 | /usr/local/share/lua/5.1/kong/pdk/private/phases.lua:73: in function 'check_phase'
api-gateway_1 | /usr/local/share/lua/5.1/kong/pdk/service/response.lua:278: in function 'call_pdk_method'
api-gateway_1 | /usr/local/share/lua/5.1/kong/db/dao/plugins/go.lua:338: in function 'bridge_loop'
api-gateway_1 | /usr/local/share/lua/5.1/kong/db/dao/plugins/go.lua:461: in function </usr/local/share/lua/5.1/kong/db/dao/plugins/go.lua:459>, context: ngx.timer, client: 172.31.0.1, server: 0.0.0.0:8000
so, anyone knows about this error? and how could i solve them?