Open hishamhm opened 3 weeks ago
@teb510 Root cause here is that the jq syntax is invalid. The giveaway is the message "filter compilation failed", which is internal to the jq
node. For our first alpha MVP that was fine, but yes, we should try to provide better diagnostics for this. From a quick look at the jq library we're using, the good news is that I think we can! https://docs.rs/jaq-interpret/latest/jaq_interpret/struct.ParseCtx.html#structfield.errs
@flrgh My first approach at thinking about this is that we could, instead of failing at building the node, succeed and store the errors, and then on run()
, we'd make it return Fail
to produce an HTTP 500, and then include the error diagnostics in the Fail
payload, so that they appear as part of the debug trace. How does that sound?
hey @hishamhm i'm still seeing errors here with a variety of strategies and seeing success for single word headers.
maybe the right question is how do i refer to the value of a header, and in particular, one with a two word name within a jq node? i'm seeing single word headers work and multi word headers fail when using the $
not using the $
will fail for even single word headers..
for example: the below works -
- name: JOIN
inputs:
- cat: CAT_FACT.body
- chuck: CHUCK_NORRIS_FACT.body
- chuck_headers: CHUCK_NORRIS_FACT.headers
jq: |
{
"cat_fact": $cat.fact,
"chuck_norris_fact": $chuck.value,
"cf-ray-chuck": $chuck_headers.vary,
}
type: jq
the following would fail
- name: JOIN
inputs:
- cat: CAT_FACT.body
- chuck: CHUCK_NORRIS_FACT.body
- chuck_headers: CHUCK_NORRIS_FACT.headers
jq: |
{
"cat_fact": $cat.fact,
"chuck_norris_fact": $chuck.value,
"cf-ray-chuck": chuck_headers.vary,
}
type: jq
and then any use of cf-ray
cf_ray
with chuck_headers
or $chuck_headers
will fail. when i return the headers direclty to the body - i see that Cf-Ray is normalized to cf-ray
so i thought that would work but it doesn't.
headers with multiple words seems like an edge case except that proxies add headers with multiple words - and you may even want to grab the kong headers and do something with them
Originally reported by @teb510