I’m trying to API query from Grafana Cloud.
I’ve got this JavaScript file:
const url = new URL('/<apache proxy>' + '/loki/api/v1/labels', window.location.origin);
const user = '<user>';
const apikey = '<apikey>';
fetch(url.toString(), {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(user + ':' + apikey)
},
})
.then((response) => console.log(response));
And it gives me this error:
Response {
body: (...)
bodyUsed: false
headers: Headers {}
ok: false
redirected: false
status: 500
statusText: "Internal Server Error"
type: "basic"
url: "http://<server>/<proxy>/loki/api/v1/labels"
[[Prototype]]: Response
}
How do I fix this?