grafana / google-sheets-datasource

The Google Sheets data source plugin allows you to visualize Google Spread Sheets data in a Grafana dashboards.
https://grafana.com/docs/plugins/grafana-googlesheets-datasource/latest/
Apache License 2.0
161 stars 28 forks source link

Fix error source in errors with invalid JWT information #269

Closed ivanahuckova closed 1 month ago

ivanahuckova commented 2 months ago

This PR takes care of false-positive plugin errors identified in https://ops.grafana-ops.net/goto/BHCltU6SR?orgId=1. The main issue is that if users input invalid Google JWT information - for example incorrect email:

image

The returned error was plugin error as we weren't handling that case. This PR fixes it by checking for *oauth2.RetrieveError and based on status code from that error sets the error source. It also removes a logic to check for timeouts, as bumped grafana-plugin-sdk-go takes care of it. We have tests in place for this and they are passing even with removed logic, as sdk correctly handles it.

Now this is fixed to downstream:

image

Also I had to fix some lint issues (see https://drone.grafana.net/grafana/google-sheets-datasource/447/1/8) - I have added a comments to them bellow.