Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error source for invalid or missing authentication token #1927

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [4.5.8] - 2024-12-05

- Chore: Fix error source for invalid or missing authentication token

## [4.5.7] - 2024-10-30

- Chore: Bump uplot to 1.6.31
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grafana-zabbix",
"version": "4.5.7",
"version": "4.5.8",
"description": "Zabbix plugin for Grafana",
"homepage": "http://grafana-zabbix.org",
"bugs": {
Expand Down
4 changes: 2 additions & 2 deletions pkg/zabbix/zabbix.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ func (zabbix *Zabbix) Authenticate(ctx context.Context) error {
if authType == settings.AuthTypeToken {
token, exists := zabbix.dsInfo.DecryptedSecureJSONData["apiToken"]
if !exists {
return errors.New("cannot find Zabbix API token")
return backend.DownstreamError(errors.New("cannot find Zabbix API token"))
}
err = zabbix.api.AuthenticateWithToken(ctx, token)
if err != nil {
zabbix.logger.Error("Zabbix authentication error", "error", err)
return err
return backend.DownstreamError(err)
Copy link
Collaborator

@yesoreyeram yesoreyeram Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. While you are here, can you also update the remaining auth errors in this file such as https://github.com/grafana/grafana-zabbix/pull/1927/files#diff-5208b24d9796d40dfcd17ea2b6bc1f0b592a8358db7416e02ace589ab32b90f2R147 otherwise we may end up in multiple patch releases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that and that has more complex logic. So will need to address it better. Turning this to draft in the meantime.

}
zabbix.logger.Debug("Using API token for authentication")
return nil
Expand Down
Loading