Skip to content

Conversation

@thomasqueirozb
Copy link
Contributor

@thomasqueirozb thomasqueirozb commented Nov 12, 2025

Summary

VRL compilation errors in http_client source query parameters now cause Vector to fail at startup instead of logging a warning and continuing with invalid expressions. This prevents unexpected behavior where malformed VRL expressions would be sent as literal strings in HTTP requests.

Previously, if a VRL expression had a syntax error in a query parameter, Vector would log a warning but continue running, passing the invalid VRL as a literal string. Now, Vector properly fails to start with a clear error message pointing to the compilation issue.

Vector configuration

Invalid configuration (now fails to start):

sources:
  test_http:
    type: http_client
    endpoint: http://httpbin.org/get
    scrape_interval_secs: 60
    query:
      timestamp:
        value: "now("  # Missing closing parenthesis
        type: vrl

sinks:
  console:
    type: console
    inputs:
      - test_http
    encoding:
      codec: json

Valid configuration (works correctly):

sources:
  test_http:
    type: http_client
    endpoint: http://httpbin.org/get
    scrape_interval_secs: 60
    query:
      timestamp:
        value: "now()"
        type: vrl

sinks:
  console:
    type: console
    inputs:
      - test_http
    encoding:
      codec: json

How did you test this PR?

  1. Created a test configuration with an invalid VRL expression (now( without closing parenthesis)
  2. Ran Vector before the fix - confirmed it logged a warning but continued to start and run
  3. Applied the fix to make Query::new(), compile_value(), and compile_param() return Result types
  4. Added VrlCompilationError variant to sources::BuildError
  5. Rebuilt Vector and ran with the same invalid configuration - confirmed Vector now fails to start with a clear error message
  6. Tested with a valid VRL expression (now()) - confirmed Vector starts and runs correctly

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

@github-actions github-actions bot added the domain: sources Anything related to the Vector's sources label Nov 12, 2025
@thomasqueirozb thomasqueirozb marked this pull request as ready for review November 12, 2025 20:26
@thomasqueirozb thomasqueirozb requested a review from a team as a code owner November 12, 2025 20:26
@thomasqueirozb thomasqueirozb requested a review from pront November 12, 2025 21:22
@thomasqueirozb thomasqueirozb added this pull request to the merge queue Nov 13, 2025
Merged via the queue into master with commit b367f7d Nov 13, 2025
64 checks passed
@thomasqueirozb thomasqueirozb deleted the fix-http-client-vrl-compilation-errors branch November 13, 2025 20:51
elkh510 pushed a commit to elkh510/vector that referenced this pull request Nov 19, 2025
…ectordotdev#24223)

* fix(http_client): fail on VRL compilation errors in query parameters

* cargo fmt

* Use sources::BuildError for Err type instead of String

* Update changelog
elkh510 pushed a commit to elkh510/vector that referenced this pull request Nov 19, 2025
…ectordotdev#24223)

* fix(http_client): fail on VRL compilation errors in query parameters

* cargo fmt

* Use sources::BuildError for Err type instead of String

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

Labels

domain: sources Anything related to the Vector's sources

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants