{"record":{"id":"712199c60bd4202f","repo":"grafana/k6","slug":"sigv4-seems-to-be-partially-configured-all-of-k6","errorCode":null,"errorMessage":"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","messagePattern":"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","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/prometheusrw/remotewrite/config.go","lineNumber":144,"sourceCode":"\tif conf.TLSMinVersion.Valid && conf.TLSMinVersion.String == \"1.2\" {\n\t\ttlsMinVersion = tls.VersionTLS12\n\t}\n\n\thc.TLSConfig = &tls.Config{\n\t\tInsecureSkipVerify: conf.InsecureSkipTLSVerify.Bool, //nolint:gosec\n\t\tMinVersion:         tlsMinVersion,\n\t}\n\n\tif conf.ClientCertificate.Valid && conf.ClientCertificateKey.Valid {\n\t\tcert, err := tls.LoadX509KeyPair(conf.ClientCertificate.String, conf.ClientCertificateKey.String)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load the TLS certificate: %w\", err)\n\t\t}\n\t\thc.TLSConfig.Certificates = []tls.Certificate{cert}\n\t}\n\n\tif isSigV4PartiallyConfigured(conf.SigV4Region, conf.SigV4AccessKey, conf.SigV4SecretKey) {\n\t\treturn nil, errors.New(\n\t\t\t\"sigv4 seems to be partially configured. All of \" +\n\t\t\t\t\"K6_PROMETHEUS_RW_SIGV4_REGION, K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY, K6_PROMETHEUS_RW_SIGV4_SECRET_KEY \" +\n\t\t\t\t\"must all be set. Unset all to bypass sigv4\",\n\t\t)\n\t}\n\n\tif conf.SigV4Region.Valid && conf.SigV4AccessKey.Valid && conf.SigV4SecretKey.Valid {\n\t\thc.SigV4 = &sigv4.Config{\n\t\t\tRegion:             conf.SigV4Region.String,\n\t\t\tAwsAccessKeyID:     conf.SigV4AccessKey.String,\n\t\t\tAwsSecretAccessKey: conf.SigV4SecretKey.String,\n\t\t}\n\t}\n\n\tif len(conf.Headers) > 0 {\n\t\thc.Headers = make(http.Header)\n\t\tfor k, v := range conf.Headers {\n\t\t\thc.Headers.Add(k, v)","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/output/prometheusrw/remotewrite/config.go#L126-L162","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set all three variables together: K6_PROMETHEUS_RW_SIGV4_REGION, K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY, K6_PROMETHEUS_RW_SIGV4_SECRET_KEY","If signing is not wanted, unset all three variables (that is the documented bypass)","Check for typos or trailing whitespace in the variable names/values, e.g. via `env | grep K6_PROMETHEUS_RW_SIGV4`","If you meant to reuse ambient AWS credentials, copy them into the three K6_ variables explicitly"],"exampleFix":"# before\nexport K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY=AKIA...\nexport K6_PROMETHEUS_RW_SIGV4_SECRET_KEY=...\n# region missing -> error 220\n\n# after\nexport K6_PROMETHEUS_RW_SIGV4_REGION=us-east-1\nexport K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY=AKIA...\nexport K6_PROMETHEUS_RW_SIGV4_SECRET_KEY=...","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nset -eu\nvars=(K6_PROMETHEUS_RW_SIGV4_REGION K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY K6_PROMETHEUS_RW_SIGV4_SECRET_KEY)\nset_count=0\nfor v in \"${vars[@]}\"; do [ -n \"${!v:-}\" ] && set_count=$((set_count+1)); done\nif [ \"$set_count\" -ne 0 ] && [ \"$set_count\" -ne 3 ]; then\n  echo \"sigv4 partially configured ($set_count/3) - set all or none\" >&2; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the three sigv4 variables in one exported block in CI so they are set or unset together","Never rely on ambient AWS_* variables being picked up — k6 only reads the K6_PROMETHEUS_RW_SIGV4_ names","Add a pre-flight env check in the CI job before invoking k6"],"tags":["prometheus","remote-write","aws","sigv4","environment-variables","configuration"],"backgroundTag":"incomplete-environment-variables","analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}