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

Error configuring datasource #15

Closed
richardbeumer opened this issue May 28, 2020 · 18 comments
Closed

Error configuring datasource #15

richardbeumer opened this issue May 28, 2020 · 18 comments

Comments

@richardbeumer
Copy link

richardbeumer commented May 28, 2020

Hello there,

After filling out my Strava ClientID and connect with Strava I get redirected. When I allow my Strava APP I get redirected back to Grafana but all fields are empty. When hitting Save & Test I get the error: Cannot connect to Strava API

My Logs show:

t=2020-05-28T13:37:59+0200 lvl=eror msg="Metric request error" logger=context userId=1 orgId=1 uname=admin error="rpc error: code = Unknown desc = Refresh token not found, authorize datasource first"
t=2020-05-28T13:37:59+0200 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/tsdb/query status=500 remote_addr=192.168.3.14 time_ms=6 size=34 referer="http://grafana.rb.lab/datasources/edit/7/?state=&code=aece2c63586295835f4cfa5f2e4e2a0be0a7a3ee&scope=read,activity:read_all,profile:read_all,read_all"

What is going wrong here?

@alexanderzobnin
Copy link
Collaborator

@richardbeumer could you post some screenshots of the problem? if auth code field is empty, try to copy code param from the URL string you have after Strava redirects you back to the data source config page.

@fcspiteri
Copy link

I'm having a similar issue. Here are my steps:

  1. Enter my Client ID in the Client ID field.
  2. Click Connect with Strava. I click Authorize and am redirected to my Grafana Datasource settings page.
  3. Enter Client ID and Client Secret from my Strava API page.
  4. Click Save & Test. I get the following error:

image

@alexanderzobnin
Copy link
Collaborator

Do you have a code url param when you redirected back to the grafana?

@alexanderzobnin
Copy link
Collaborator

Url should look like https://grafana.example.org/datasources/edit/14/?state=&code=324469231...&scope=read,activity:read_all,profile:read_all,read_all

@fcspiteri
Copy link

I do get a code url param:
http://192.168.86.40:3000/datasources/edit/7/?state=&code=1629cd7.....&scope=read,activity:read_all,profile:read_all,read_all

@alexanderzobnin
Copy link
Collaborator

Hm, that strange. What do you get in the grafana-server logs after pressing save and test (make sure debug logging is enabled)?

@fcspiteri
Copy link

t=2020-10-15T05:56:48-0700 lvl=eror msg="Strava API request error" logger=plugins.backend pluginId=grafana-strava-datasource error="Auth error, status: 401 Unauthorized"
t=2020-10-15T05:56:48-0700 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/datasources/11/resources/auth status=500 remote_addr=192.168.86.38 time_ms=1971 size=82 referer="http://192.168.86.40:3000/datasources/edit/11/?state=&code=a003a0.......&scope=read,activity:read_all,profile:read_all,read_all"
t=2020-10-15T05:56:48-0700 lvl=eror msg="open /11-refreshToken: no such file or directory" logger=plugins.backend pluginId=grafana-strava-datasource
t=2020-10-15T05:56:48-0700 lvl=eror msg="Strava API request error" logger=plugins.backend pluginId=grafana-strava-datasource error="Refresh token not found, authorize datasource first"
t=2020-10-15T05:56:48-0700 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/datasources/11/resources/strava-api status=500 remote_addr=192.168.86.38 time_ms=23 size=97 referer="http://192.168.86.40:3000/datasources/edit/11/?state=&code=a003a0.......&scope=read,activity:read_all,profile:read_all,read_all"

`

@alexanderzobnin
Copy link
Collaborator

Try to configure GF_STRAVA_DS_DATA_PATH variable to point plugin to the grafana data directory (refresh tokens are stored in this folder), like

export GF_STRAVA_DS_DATA_PATH=/var/lib/grafana/strava

@richardbeumer
Copy link
Author

After updating grafana to the latest version my issue is gone now. I cannot reproduce the issue anymore.

Thnx for the support.

@tmikolajczyk
Copy link

@alexanderzobnin, I've got exactly the same issue as the topic author. I configured env variable properly (Win10, path C:\Program Files\GrafanaLabs\grafana\strava). Any other suggestions?
Grafana 7.3.4

@dbffm
Copy link

dbffm commented Nov 30, 2020

@alexanderzobnin, I've got exactly the same issue as the topic author. I configured env variable properly (Win10, path C:\Program Files\GrafanaLabs\grafana\strava). Any other suggestions?
Grafana 7.3.4

same here. I am using Grafana via Docker Container. In that container I created directory /var/lib/grafana/strava and configured ENV Variable GF_STRAVA_DS_DATA_PATH to point to that directory.

Still getting the message "Refresh token not found, authorize datasource first"

Any hints?

@alexanderzobnin
Copy link
Collaborator

@tmikolajczyk Could you provide grafana-server logs (after pressing Connect with strava button and then save and test)?

@tmikolajczyk
Copy link

@alexanderzobnin, sure!

t=2020-12-01T15:23:13+0100 lvl=eror msg="Strava API request error" logger=plugins.backend pluginId=grafana-strava-datasource error="Auth error, status: 401 Unauthorized"
t=2020-12-01T15:23:13+0100 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/datasources/1/resources/auth status=500 remote_addr=[::1] time_ms=749 size=82 referer="http://localhost:3000/datasources/edit/1/?state=&code=1e1d65a91b9a2f00ac143a7b72f8a985db73b6aa&scope=read,activity:read_all,profile:read_all,read_all"
t=2020-12-01T15:23:13+0100 lvl=eror msg="open /1-refreshToken: The system cannot find the file specified." logger=plugins.backend pluginId=grafana-strava-datasource
t=2020-12-01T15:23:13+0100 lvl=eror msg="Strava API request error" logger=plugins.backend pluginId=grafana-strava-datasource error="Refresh token not found, authorize datasource first"
t=2020-12-01T15:23:13+0100 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/datasources/1/resources/strava-api status=500 remote_addr=[::1] time_ms=11 size=97 referer="http://localhost:3000/datasources/edit/1/?state=&code=1e1d65a91b9a2f00ac143a7b72f8a985db73b6aa&scope=read,activity:read_all,profile:read_all,read_all"

@garymcleanuk
Copy link

i am getting same too with Grafana 1.2.0

t=2020-12-26T16:27:49+0000 lvl=eror msg="open /4-refreshToken: no such file or directory" logger=plugins.backend pluginId=grafana-strava-datasource
t=2020-12-26T16:27:49+0000 lvl=eror msg="Strava API request error" logger=plugins.backend pluginId=grafana-strava-datasource error="Refresh token not found, authorize datasource first"
t=2020-12-26T16:27:49+0000 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/datasources/4/resources/strava-api status=500 remote_addr=192.168.8.121 time_ms=28 size=97 referer=http://192.168.8.240:3000/datasources/edit/4/
^C

@garymcleanuk
Copy link

@alexanderzobnin, I've got exactly the same issue as the topic author. I configured env variable properly (Win10, path C:\Program Files\GrafanaLabs\grafana\strava). Any other suggestions?
Grafana 7.3.4

same here. I am using Grafana via Docker Container. In that container I created directory /var/lib/grafana/strava and configured ENV Variable GF_STRAVA_DS_DATA_PATH to point to that directory.

Still getting the message "Refresh token not found, authorize datasource first"

Any hints?

same here on a fresh install... Guess the API has changed?

@garymcleanuk
Copy link

Browser launches this from Save and Test in Grafana https://www.strava.com/oauth/authorize?client_id=XXXXX&response_type=code&redirect_uri=http://192.168.8.240:3000/datasources/edit/4/&approval_prompt=force&scope=read_all,profile:read_all,activity:read_all

Strava API Errors
{"message":"Bad Request","errors":[{"resource":"Application","field":"redirect_uri","code":"invalid"}]}

@garymcleanuk
Copy link

I fixed mine after reading the Strava API Reference..

Make sure your Call Back domain configured on the Strave API Website contains the IP Address of the grafana server used on net..

@lennon101
Copy link

Is this still broken? I'm having a lot of troubles - see my comment at the bottom of the thread for issue #70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants