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
Describe what are you trying to do:
Hello, I want to modify the merged request of two backends when one of them fails with an error like context deadline exceeded. Currently, both backends send a json payload (same structure) with different contents. KrakenD merges them according to the backend (by using the deny fields). The problem relies when one of them fails, our client wont be able to parse the HTTP Headers returned (X-KrakenD-Complete) so that we need to modify the response.
[GIN] 2025/03/25 - 16:32:49 | 200 | 23.557788ms | 10.114.5.16 | GET "/v1/endpoint"
Number of keys: 18 -> not faulty backend
Additional comments:
So basically the logic was to remove all keys when the merged response has less keys as expected in the json object (result of missing one of the backends, because of the deny fields the merged response would have less number of keys. This code was just a test).
The problem is , as noted in the logs above, the script is only executed when both backends respond. If one of them is not reachable then KrakenD does not execute the Lua script.
The text was updated successfully, but these errors were encountered:
Environment info:
Describe what are you trying to do:
Hello, I want to modify the merged request of two backends when one of them fails with an error like context deadline exceeded. Currently, both backends send a json payload (same structure) with different contents. KrakenD merges them according to the backend (by using the deny fields). The problem relies when one of them fails, our client wont be able to parse the HTTP Headers returned (X-KrakenD-Complete) so that we need to modify the response.
Your configuration file:
Lua Script:
Commands used:
Logs:
2025/03/25 16:33:01 KRAKEND ERROR: [ENDPOINT: /v1/endpoint] Error #0: context deadline exceeded
[GIN] 2025/03/25 - 16:33:01 | 200 | 4.255016405s | 10.114.5.16 | GET "/v1/endpoint"
Error #1: context deadline exceeded -> with faulty backend
[GIN] 2025/03/25 - 16:32:49 | 200 | 23.557788ms | 10.114.5.16 | GET "/v1/endpoint"
Number of keys: 18 -> not faulty backend
Additional comments:
So basically the logic was to remove all keys when the merged response has less keys as expected in the json object (result of missing one of the backends, because of the deny fields the merged response would have less number of keys. This code was just a test).
The problem is , as noted in the logs above, the script is only executed when both backends respond. If one of them is not reachable then KrakenD does not execute the Lua script.
The text was updated successfully, but these errors were encountered: