Skip to content

Ruler remote_write bearer token is not included in the request #17050

Open
@juusujanar

Description

@juusujanar

Describe the bug
I have the following ruler configuration

ruler:
  remote_write:
    clients:
      victoriametrics:
        authorization:
          credentials: <random string>
          type: Bearer
        url: https://vminsert.example.com/prometheus/api/v1/write
    enabled: true

But VictoriaMetrics is rejecting this request with HTTP 401 Unauthorized. When investigating the incoming HTTP request via Wireshark, the token is not included, but instead <secret> is used.

Image

This seems to be similar to this issue, but with Bearer token now: #5140

To Reproduce
Steps to reproduce the behavior:

  1. Started Loki 3.4.2
  2. Started Prometheus/VictoriaMetrics, where write endpoint is protected with bearer token
  3. Configured Loki ruler to write recording rules results to Prometheus/VictoriaMetrics using bearer token
  4. Loki is outputting error
ts=2025-04-07T13:21:32.770110871Z caller=dedupe.go:112 storage=registry manager=tenant-wal instance=fake component=remote level=error remote_name=fake-rw-victoriametrics url=https://vminsert.example.com/prometheus/api/v1/write msg="non-recoverable error" failedSampleCount=63 failedHistogramCount=0 failedExemplarCount=0 err="server returned HTTP status 401 Unauthorized: Unauthorized\n"

Expected behavior
Ruler calculated metrics are sent to Prometheus/VictoriaMetrics successfully.

Environment:

  • Infrastructure: Kubernetes
  • Deployment tool: Helm
/ $ /usr/bin/loki -version
loki, version 3.4.2 (branch: release-3.4.x, revision: 4fa045d3)
  build user:       root@buildkitsandbox
  build date:       2025-02-14T08:42:52Z
  go version:       go1.23.6
  platform:         linux/arm64
  tags:             netgo

Screenshots, Promtail config, or terminal output
If applicable, add any output to help explain your problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions