add better error if credentials are invalid

This commit is contained in:
Megan Bang 2021-10-07 16:28:47 -05:00
parent d05fa3049e
commit 348c761bea
1 changed files with 4 additions and 0 deletions

View File

@ -141,6 +141,10 @@ func (b *Backend) configure(ctx context.Context) error {
return fmt.Errorf("Error loading credentials: %s", err)
}
if !strings.HasPrefix(contents, "{") {
return fmt.Errorf("contents of credentials are invalid")
}
credOptions = append(credOptions, option.WithCredentialsJSON([]byte(contents)))
}