IzakMarais / reporter

Service that generates a PDF report from a Grafana dashboard
Apache License 2.0
963 stars 309 forks source link

401 Unauthorized - Both HTTP API and CLI #261

Closed cawhite6 closed 3 years ago

cawhite6 commented 3 years ago

Just started receiving this error - seems unrelated to the others in open status. Meaning yes I receive the error but only started with latest update to 7.3. We haven't had the need to generate reports until after the update so unsure if its related to the 7.3 update or not.

I have had no issues with reporting so the only environment change is subsequent updates from grafana 6.x

Example Dashboard link: http://grafanaFQDN:8686/api/v5/report/w_a4jLpGk?apitoken=[APIKEY]

ran from cli and same web UI error - Error generating report: error fetching dashboard w_a4jLpGk: error obtaining dashboard from http://grafanaFQDN:3000/api/dashboards/uid/w_a4jLpGk. Got Status 401 Unauthorized, message: {"message":"Unauthorized"}

I deleted and added new API key and get 'Invalid API' if I do not update the url or cli, once I do I still get 401 back. There is no debug in logs and is an immediate 401 from web UI, cli shows it is being called and once it finds dashboard returns 401.

All of this is being done with Admin level permissions on folders, dashboards and API. Again was working fine when last run which was prior to 7.x updates on Grafana.

Any direction is appreciated - container installed on Ubuntu 18

cawhite6 commented 3 years ago

Found my issue after doing a direct curl for api from cli - returning 301 Moved Perm error.

culprit was in the grafana.ini enforce_domain was set to true, moved to false and everything is working again.