lura
lura copied to clipboard
Request Response Modifier doesn't work in the same go file
Describe the bug I have created a repo here which replicates the new plugin modifier as mentioned in docs
when we use this plugin to run the krakend configuration, it only attaches the first modifier created inside the RegisterModifier method in the above example its request modifier.
I tried to use the different names for both the modifier by following the doc like mentioned in the #543
f(string(r)+"-request", r.requestDump, true, false)
f(string(r)+"-response", r.responseDump, false, true)
but even this is only registering the 1st modifier,
when I comment out the 1st modifier , 2nd one starts working.
So it seems like only one plugin modifier will work for given RegisterModifiers
To Reproduce Steps to reproduce the behavior:
- Configuration used : https://github.com/trojanh/krakend-plugin-modifier/blob/master/krakend.plugin.json
Expected behavior Ideally both the modifier should have worked to handle the request and response.
the documentation contained some errors and was updated some days ago. please, check again the response wrapper interface and avoid using the same name for both modifiers
hey @kpacha I had done most of the changes but I verified again from the doc and I got following logs, which clearly indicates none of the modifier were loaded if I use the same modifier code.
which clearly
after which I replaced below line
f(string(r)+"-request", r.requestDump, true, false)
f(string(r)+"-response", r.responseDump, false, true)
with this
f(string(r)+"-request", r.requestDump, true, false)
f(string(r), r.responseDump, false, true)
and now the the response modifier started working but request modifier still did not work as it has different name maybe ?.
I have updated the code here https://github.com/trojanh/krakend-plugin-modifier/blob/master/krakend.plugin.json
I am not sure but does it have something to do with this line ? https://github.com/luraproject/lura/blob/633684c4153c429a62fe7299b401dbdf9a1dc811/proxy/plugin/modifier.go#L47
don't forget to add the proper plugin names on your configuration (krakend-debugger-request & krakend-debugger-response)
I guess that was the missing piece, seems to be working now thanks @kpacha
here is the working example https://github.com/trojanh/krakend-plugin-modifier/blob/master/krakend.plugin.json
Also updated the missing documentation for this along with updated example configuration https://github.com/devopsfaith/krakend-documentation/pull/150
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.