Hi Team,
I identified the reason for the “error while substituting templates” issue.
The values required by the request template are already stored as iparams. This includes both secure and normal iparams. The issue occurs when we retrieve an already configured iparam value through context and pass it to the request template.
The main issue is that, if a key name is already present as an iparam, passing the same key name through context causes a template substitution error.
For example, if domain is already configured as an iparam, and we pass domain again through context:
context: {
domain: value
}
and use:
<%= context.domain %>
it results in a template substitution error.
Similarly, if project_id is already configured as an iparam, but we need to pass a different/dynamic project ID through context using the same key:
context: {
project_id: value
}
this also results in a template substitution error.
However, if the context key is different from the existing iparam key, there is no issue and the request works successfully.
For example:
context: {
dynamic_project_id: value
}
works because dynamic_project_id is not an existing iparam key.
However, when the same value is directly referenced from the iparam:
<%= iparam.domain %>
the template works correctly.
The same approach is used for the secure api_key:
<%= encode(iparam.api_key) %>
So the working approach is to directly reference values that are already configured as iparams using iparam.<parameter_name>, instead of passing those same iparam values again through context.
This works for both:
Therefore, the template substitution issue has been resolved by directly using the configured iparam values in the request template and avoiding the use of the same key name in both iparam and context.
Thanks.