grafana/k6 · error

sigv4 seems to be partially configured. All of…

Error message

sigv4 seems to be partially configured. All of K6_PROMETHEUS_RW_SIGV4_REGION, K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY, K6_PROMETHEUS_RW_SIGV4_SECRET_KEY must all be set. Unset all to bypass sigv4

What it means

k6's Prometheus remote-write output can sign requests with AWS Signature V4. Signing is opt-in via three environment variables (K6_PROMETHEUS_RW_SIGV4_REGION, K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY, K6_PROMETHEUS_RW_SIGV4_SECRET_KEY), and the output refuses to start if only some of them are set, because a half-signed request would be rejected by the remote write endpoint anyway.

Solutions

  1. Set all three variables together: K6_PROMETHEUS_RW_SIGV4_REGION, K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY, K6_PROMETHEUS_RW_SIGV4_SECRET_KEY
  2. If signing is not wanted, unset all three variables (that is the documented bypass)
  3. Check for typos or trailing whitespace in the variable names/values, e.g. via `env | grep K6_PROMETHEUS_RW_SIGV4`
  4. If you meant to reuse ambient AWS credentials, copy them into the three K6_ variables explicitly

Example fix

# before
export K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY=AKIA...
export K6_PROMETHEUS_RW_SIGV4_SECRET_KEY=...
# region missing -> error 220

# after
export K6_PROMETHEUS_RW_SIGV4_REGION=us-east-1
export K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY=AKIA...
export K6_PROMETHEUS_RW_SIGV4_SECRET_KEY=...
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
set -eu
vars=(K6_PROMETHEUS_RW_SIGV4_REGION K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY K6_PROMETHEUS_RW_SIGV4_SECRET_KEY)
set_count=0
for v in "${vars[@]}"; do [ -n "${!v:-}" ] && set_count=$((set_count+1)); done
if [ "$set_count" -ne 0 ] && [ "$set_count" -ne 3 ]; then
  echo "sigv4 partially configured ($set_count/3) - set all or none" >&2; exit 1
fi

Prevention

When it happens

Trigger: Starting k6 with `--out experimental-prometheus-rw` (or the newer `-O prometheus-rw` naming) where the isSigV4PartiallyConfigured check in internal/output/prometheusrw/remotewrite/config.go finds between one and two of the three K6_PROMETHEUS_RW_SIGV4_* variables set — e.g. the access key and secret are exported in CI but the region variable is missing or misspelled.

Common situations: Teams that already have AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_DEFAULT_REGION in their environment and assume k6 reads those (it does not — it only reads the K6_PROMETHEUS_RW_SIGV4_-prefixed names); copy-pasting only part of the sigv4 block from docs; a stray variable left set in a Docker image or CI mask while the others are injected per-job.

Related errors


AI-assisted analysis of grafana/k6@8d06114777 (2026-08-18). Data as JSON: /api/errors/712199c60bd4202f. Report an issue: GitHub.

Appendix: source

Thrown at internal/output/prometheusrw/remotewrite/config.go:144

	if conf.TLSMinVersion.Valid && conf.TLSMinVersion.String == "1.2" {
		tlsMinVersion = tls.VersionTLS12
	}

	hc.TLSConfig = &tls.Config{
		InsecureSkipVerify: conf.InsecureSkipTLSVerify.Bool, //nolint:gosec
		MinVersion:         tlsMinVersion,
	}

	if conf.ClientCertificate.Valid && conf.ClientCertificateKey.Valid {
		cert, err := tls.LoadX509KeyPair(conf.ClientCertificate.String, conf.ClientCertificateKey.String)
		if err != nil {
			return nil, fmt.Errorf("failed to load the TLS certificate: %w", err)
		}
		hc.TLSConfig.Certificates = []tls.Certificate{cert}
	}

	if isSigV4PartiallyConfigured(conf.SigV4Region, conf.SigV4AccessKey, conf.SigV4SecretKey) {
		return nil, errors.New(
			"sigv4 seems to be partially configured. All of " +
				"K6_PROMETHEUS_RW_SIGV4_REGION, K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY, K6_PROMETHEUS_RW_SIGV4_SECRET_KEY " +
				"must all be set. Unset all to bypass sigv4",
		)
	}

	if conf.SigV4Region.Valid && conf.SigV4AccessKey.Valid && conf.SigV4SecretKey.Valid {
		hc.SigV4 = &sigv4.Config{
			Region:             conf.SigV4Region.String,
			AwsAccessKeyID:     conf.SigV4AccessKey.String,
			AwsSecretAccessKey: conf.SigV4SecretKey.String,
		}
	}

	if len(conf.Headers) > 0 {
		hc.Headers = make(http.Header)
		for k, v := range conf.Headers {
			hc.Headers.Add(k, v)

View on GitHub (pinned to 8d06114777)