Skip to content

Commit 73ccfe0

Browse files
committed
fix: improve bearerinjector logging for missing credentials
When GetSecret fails, the error message now mentions the -credentials-paths flag so users know how to configure the secret source. Also updates the bearerinjector documentation to link to the egress reference and note the -credentials-paths requirement. Fixes #3507
1 parent 64c3597 commit 73ccfe0

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

docs/reference/filters.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3463,6 +3463,10 @@ from file providing the token as content.
34633463
It is a special form of `setRequestHeaderFromSecret` with `"Authorization"` header name,
34643464
`"Bearer "` prefix and empty suffix.
34653465
3466+
The token file must be located in a directory passed via the `-credentials-paths` flag.
3467+
See the [egress reference](https://opensource.zalando.com/skipper/reference/egress/#example-bearer-injection)
3468+
for a complete configuration example.
3469+
34663470
Example:
34673471
34683472
```
@@ -3471,6 +3475,9 @@ egress: * -> bearerinjector("/tmp/secrets/my-token") -> "https://api.example.com
34713475
// equivalent to setRequestHeaderFromSecret("Authorization", "/tmp/secrets/my-token", "Bearer ")
34723476
```
34733477
3478+
Note: You must start skipper with `-credentials-paths=/tmp/secrets` for the
3479+
filter to find the token file.
3480+
34743481
## Open Tracing
34753482
### tracingBaggageToTag
34763483

filters/auth/bearer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func newBearerInjectorFilter(s string, sr secrets.SecretsReader) *bearerInjector
5353
func (f *bearerInjectorFilter) Request(ctx filters.FilterContext) {
5454
b, ok := f.secretsReader.GetSecret(f.secretName)
5555
if !ok {
56-
log.Errorf("Secret %q not found for bearerinjector filter", f.secretName)
56+
log.Errorf("Secret %q not found for bearerinjector filter. Make sure the file exists in a directory passed via -credentials-paths flag.", f.secretName)
5757
return
5858
}
5959
ctx.Request().Header.Set(authHeaderName, authHeaderPrefix+string(b))

0 commit comments

Comments
 (0)