Skip to content

Commit

Permalink
fix(newsigv4): prevent silent failure from type assertion
Browse files Browse the repository at this point in the history
If the assertion onto the `invalidator` interface fails the
extension will fail silently. Leading to misleading logs
as the confirmation of the watcher having started will
still appear.
  • Loading branch information
tanuck committed Jan 9, 2025
1 parent 9ec5466 commit 8fe9e68
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion extensions/newsigv4/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package newsigv4 // import "github.com/open-telemetry/opentelemetry-collector-co
import (
"context"
"errors"
"fmt"
"net/http"

"github.com/aws/aws-sdk-go-v2/aws"
Expand Down Expand Up @@ -105,7 +106,7 @@ func (sa *sigv4Auth) startWatcher() error {

cache, ok := (*sa.cfg.credsProvider).(invalidator)
if !ok {
return nil
return fmt.Errorf("credentials provider does not implement invalidator interface: %T", *sa.cfg.credsProvider)
}

go func() {
Expand Down

0 comments on commit 8fe9e68

Please sign in to comment.