Same Datasource not working for the next Org

I have 2 Orgs in Grafana (localhost).
First one is handmade. Everything is working well.

Then I’ve created the second Org by API, made API-key and for this Org made a Datasource - all by API.
Datasource - settings are the same as in the first handmade Org.

Auth for the datasource: basic

Have an error “response is undefined”.

I can’t catch the qwery at my back - query don’t achieve my basic path: http://localhost/GrafanaService/ as it does in handmade Org.

In the log file I have such message:

t=2019-11-15T09:39:54+0300 lvl=eror msg=“Basic auth failed” logger=context error=“User not found”
t=2019-11-15T09:39:54+0300 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/api/datasources/proxy/26/ status=401 remote_addr= time_ms=0 size=31 referer=http://localhost:8080/datasources/edit/26/

handmade datasource for this Org is not working too - the same error.

When making another one datasource, for exaple, Graphite with my path http://localhost/GrafanaService/ - it works. And I can catch the wuery at my back. Logs are:
t=2019-11-15T09:58:42+0300 lvl=info msg=“Request Completed” logger=context userId=1 orgId=14 uname=admin method=POST path=/api/datasources/proxy/28/render status=502 remote_addr= time_ms=367 size=0 referer=http://localhost:8080/datasources/edit/28/

The logs differ with userId and orgId. Whern having error my userId is 0.

How can I reach the clue and fix the error?
Rgrds, Sergey

Noticed one thing.
Can’t catch the differences between methods, but when error, then tracing shows this:
[HTTP/1.1 401 Unauthorized 0ms].

Query by Global Grafana Admin. Manually added this user to new Org.

And after that:
Object { message: “Unexpected error” }

Possibly unhandled rejection: {“message”:“Unexpected error”} angular.js:14700

  • Can you log into the second org? And did you successfully create the data source in the second org?
  • Which action in the UI or via the api is causing the error? (It’s not clear from your question)

Hi, Daniellee!
Thanks for reply.
Resolved trouble, but didn’t understand the core.

I’ve found, that password, set by default by API for my user to connect the datasource, was not correct.
The bad thing is that I’ve tried manually to change password in new Datasource, but the error was still there. So I thought about incorrect pair login/password in last turn. Seems that input login/password for Datasource was possible only once for the first time despite that JSON model of edited datasource became correct.
After making datasource by API with correct pair login/password datasource is working.

1 Like