You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configuration check output:
Result of krakend check -dtc krakend_conditional.json --lint command
Parsing configuration file: krakend_conditional.json
Global settings
Name: conditional test
Port: 8080
Folder: ./plugins/
Pattern: .so
1 global component configuration(s):
- telemetry/logging
1 API endpoint(s):
- GET /services
Timeout: 50m0s
1 endpoint component configuration(s):
- plugin/req-resp-modifier
Connecting to 3 backend(s):
[+] GET /pattern1
Timeout: 50m0s
Hosts: [http://localhost:8090]
1 backend component configuration(s):
- validation/cel
[+] GET /pattern1
Timeout: 50m0s
Hosts: [http://localhost:8090]
1 backend component configuration(s):
- validation/cel
[+] GET /pattern2
Timeout: 50m0s
Hosts: [http://localhost:8090]
1 backend component configuration(s):
- validation/cel
0 async agent(s):
Syntax OK!
Commands used:
How did you start the software?
krakend run -d -c krakend_conditional.json
Expected behavior
The objective is to call multiple backends on a endpoint conditionally and return each backend response as a JSON collection where each element is the backend response.
Each backend is called if an HTTP header values matches a condition.
Each backend has a group defined and I have written a response modifier plugin that applied to the endpoint gets the merged response and then collapses each group response and moves the group key name to the value of "name" into the each backend response and adds the response collection to a "collection" object.
Call to services endpoint should return the expected collection resulting of the custom plugin response modification but instead returns an empty JSON collection
curl http://localhost:8080/services -H 'x-group-id: group1'| jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2 100 2 0 0 163 0 --:--:-- --:--:-- --:--:-- 181
[]
Setting the endpoint's output_encoding to json shows that the backend responses were merged but the response modifier was not triggered.
This issue is marked as stale because it has been open over 90 days with no activity. Remove the stale label or comment or this will be closed in 15 days.
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.
Environment info:
Describe the bug
plugin/req-resp-modifier in an endpoint is not called if one of the backend CEL evaluations fails
Your configuration file:
Configuration check output:
Result of
krakend check -dtc krakend_conditional.json --lint
commandCommands used:
How did you start the software?
Expected behavior
The objective is to call multiple backends on a endpoint conditionally and return each backend response as a JSON collection where each element is the backend response.
Each backend is called if an HTTP header values matches a condition.
Each backend has a group defined and I have written a response modifier plugin that applied to the endpoint gets the merged response and then collapses each group response and moves the group key name to the value of
"name"
into the each backend response and adds the response collection to a"collection"
object.So each backend returns something in the likes of
Merged response would look like
And modified response by the custom plugin:
With
output_encoding
asjson-collection
we would get:Call to
services
endpoint should return the expected collection resulting of the custom plugin response modification but instead returns an empty JSON collectionSetting the endpoint's
output_encoding
tojson
shows that the backend responses were merged but the response modifier was not triggered.Logs:
The custom-plugin has logging and it should be visible with debug
Additional comments:
Changing the CEL expression with group2 to group1 so that all backends pass the CEL evaluation proves that the custom plugin works when called
Logs
The text was updated successfully, but these errors were encountered: