Skip to content

Missing template values are silently rendered as <no value> #3497

Description

@dadrus

Preflight checklist

  • I agree to follow this project's Code of Conduct.
  • I have read and am following this repository's Contribution Guidelines."
  • I could not find a solution in the existing issues, docs, nor discussions.

Describe the bug

When a Go template references a value that is not available in its evaluation context, it can silently render as <no value> instead of failing.

For endpoint URLs or headers this may result in a syntactically valid but incorrect downstream request. The resulting 400/401 response then hides the actual configuration problem.

See #3495 for the context in which this was discovered.

Expected behavior: Missing or unavailable template values should cause rendering to fail with an actionable template error instead of silently producing <no value>.

How can the bug be reproduced

Configure an endpoint template with an unavailable value, e.g.:

endpoint:
  url: http://api.internal/entitlements?tenantId={{ .Request.URL.Captures.tenantId }}

Execute the mechanism.

The rendered URL contains:

tenantId=<no value>

and the request is sent downstream instead of failing during template rendering.

Relevant log output

DBG Creating request _endpoint="http://api.internal/entitlements?tenantId=<no value>"
INF Pipeline step execution failed error="authorization error: authorization failed based on received response code: 400"

Relevant configuration

See reproduction above and #3495.

Version

v0.17.21

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Docker

Additional Context

Originally identified while investigating #3495.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions