Graph panel and snapshot: Unauthorized!

Hi!

When exporting a dashboard with a graph panel through a snapshot, I get an “Unauthorized!” message when visiting the snapshot. Note that this happens with empty as well as with graphs with data.
If I remove the graph panel from the dashboard, no “Unauthorized!” message appears.
I’m using grafana 4.6.3.

Anyone observed similar behavior and can tell me how to workaroun it?

Thanks!

Hi,

Please refer to https://github.com/grafana/grafana/issues/10484

Marcus

Hi!

Yes, I saw that bug report and solution. However, it does not solve the problem. Here’s how to reproduce it:

  1. Fresh install of grafana 4.6.3
  2. No data sources needed
  3. Create dashboard with graph panel (Test data: random walk)
  4. Create local snapshot (I’ve tried with different timeout values: 4, 30, 500, 1000)
  5. Open snapshot -> unauthorized. To be precise, the graph loads ONCE, refreshing does not work.

Error message in Chromes’ console:
Failed to load resource: the server responded with a status of 401 (Unauthorized)
angular.js:14700 Possibly unhandled rejection: {“data”:{“message”:“Unauthorized”},“status”:401,“config”:{“method”:“GET”,“transformRequest”:[null],“transformResponse”:[null],“jsonpCallbackParam”:“callback”,“url”:“api/annotations”,“params”:{“from”:1519712848272,“to”:1519734448272,“dashboardId”:1},“retry”:0,“headers”:{“Accept”:“application/json, text/plain, /”}},“statusText”:“Unauthorized”,“xhrStatus”:“complete”}
(anonymous) @ angular.js:14700
angular.js:14700 Object
(anonymous) @ angular.js:14700
angular.js:14700 Possibly unhandled rejection: {“message”:“Unauthorized”,“severity”:“warning”}
(anonymous) @ angular.js:14700

Tried your steps on the latest Grafana v5.0 beta 5 and it works as expected.

url”:“api/annotations” looks weird in error message. Do you have annotations in your dashboard?

Marcus

I’m using grafana 4.6.3, the stable version, so can’t say if the beta works. Will try later.

I don’t have any annotations, the 5 steps described above are enough to produce the issue.

Oh right. Just tried your steps on my hosted grafance instance which runs v4.6.3 stable. Works without problem, see https://mefraimsson.grafana.net/dashboard/snapshot/QDKwHgv0aM2kaqfHJ4Ds39oSOnzrA6Pj?orgId=0

Ok, this is weird. Here’s my instance, same version, it does not work:
https://data.lmsteiner.com:61055/dashboard/snapshot/QyrDy0aQktWDZDs4vmJqCCivo7hyKVwy?orgId=0

Ok, found the problem in the server configuration:
[auth.anonymous]
;enable anonymous access
enabled = true

Anonymous access must be set to true for graph panels in a snapshot. This is strange as it works without anonymous access for e.g. single value panels. Don’t know what should be the correct behavior, but as of now it is inconsistent and therefore likely a bug.

1 Like

Hi
I would not have expected for a standalone snapshot which contained all metric data points, for the not authorized alert to appear on page load as you do not need to be logged in to view a snapshot.

Can you confirm this is a Grafana bug and if it will be fixed?

putting Grafana into anonymous mode is not possible for security in my project.