Comments (7)
I did add some console.log statements to inspect variables and I noticed that the authHeader has some odd formatting around the Authorization:
So this indicates that is the correct format, but perhaps something else is at play.
Is your Hubot running on Heroku by chance? ECONNREFUSED
would indicate to me that something network related is happening. This StackOverflow comment on a similar issue points to a similar issue in another node application.
from hubot-grafana.
Sorry, no Heroku. Just a shell on a Debian box in our internal datacenter.
I can do curl to that same instance from the same shell and get a response every time using the Authorization: Bearer eyJrIjoiWXXX...XXX0=
string as my header however if I switch to Authorization: 'Bearer eyJrIjoiWXXX...XXX0='
it fails.
Setting NODE_ENV=production
in my startup script did nothing.
from hubot-grafana.
According to the Grafana API Documentation the header is used like this:
GET http://your.grafana.com/api/dashboards/db/mydash HTTP/1.1
Accept: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Additionally the example in RFC 6750 also leaves out the single quotes:
GET /resource HTTP/1.1
Host: server.example.com
Authorization: Bearer mF_9.B5f-4.1JqM
from hubot-grafana.
Ok, so this starts to look like the culprit. The trouble is that I am using how Hubot's scripting guidelines say to add headers, but the output is invalid. Wonder if something changed upstream? It appears to be limited to certain versions of Grafana and Hubot core.
from hubot-grafana.
I'll get the version of Grafana we're working on today and report it here. I also did a bit more looking around and it seems like other programs construct their headers this way, so I'm not exactly sure why it should be an issue here.
from hubot-grafana.
Worth noting that what you console.log
'd may have been correct per the spec for the HttpClient
node object as well (which is what robot.http
provides a wrapper). The assembly of the header string happens further down (and should happen without the quotes).
Wondering if we pointed the script at something like Runscope or a local machine with verbose logging if we could see what headers actually make it to the Grafana server.
from hubot-grafana.
I think you are right WRT robot.http
doing the right thing with the header. I'm afraid I didn't dig into that.
Instead I did a bit of digging around our infrastructure and got it figured out. Looks like the folks who set this up used nginx on port 80 and then grafana on another port. Curl works on both ports but hubot-grafana didn't in my case. The fix was to aim directly at the grafana port. My theory is that there is some odd interop between robot.http
and nginx/grafana enough to foul the key passing.
Again, thanks for your help. I'm going to close this, however if we want to dig into this further, please feel free to reopen.
from hubot-grafana.
Related Issues (20)
- Using with grafana server https self signed HOT 8
- Bar Guage not rendered correctly HOT 2
- When calling multiple graphs, only 2 show up HOT 7
- integrating with flowdock HOT 1
- ERROR SyntaxError: Unexpected token < in JSON at position 0 HOT 3
- graf db nginx-lua Why is the grafana homepage returned? HOT 8
- TimeZone support HOT 2
- Grafana 7: Full screen leads to localhost:3000 redirect HOT 4
- ERROR SyntaxError: Unexpected token < in JSON at position 0 HOT 3
- hubot-grafana does not work for Grafana 8 HOT 7
- Upgrade from 2.5.2 to 3.0.1: dashboards can't be accessed by slug anymore HOT 5
- Can only receive 1 image by each query which queries all panels in the dashboard HOT 2
- Allow the bot to respond in a thread HOT 2
- S3 Region breaks existing setup HOT 2
- Support for @hubot-friends/hubot-slack
- feat: clean the NPM package to make its footprint smaller
- Getting rid of the obsolete request dependency
- Tests are too slow or timing out HOT 2
- Refactor platform specific actions to adapters? HOT 3
- Download method needs API key in header HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hubot-grafana.