stephenyeargin / hubot-grafana

📈🤖 Query Grafana dashboards
http://docs.grafana.org/tutorials/hubot_howto/
MIT License
154 stars 48 forks source link

ERROR SyntaxError: Unexpected token < in JSON at position 0 #126

Closed fsckzy closed 4 years ago

fsckzy commented 4 years ago
[Tue Jul 28 2020 11:18:49 GMT+0800 (China Standard Time)] ERROR SyntaxError: Unexpected token < in JSON at position 0
  at JSON.parse (<anonymous>:null:null)
  at /data/myhubot/node_modules/hubot-grafana/src/grafana.coffee:423:7, <js>:420:21
  at IncomingMessage.<anonymous> (/data/myhubot/node_modules/scoped-http-client/src/index.js:95:22)
  at IncomingMessage.emit (events.js:203:15)
  at endReadableNT (_stream_readable.js:1145:12)
  at process._tickCallback (internal/process/next_tick.js:63:19)

The environment is as follows:

# node -v
v10.22.0
grafana 7
centos 7

Excuting an order: hubot graf list why?

stephenyeargin commented 4 years ago

Can you adjust your HUBOT_LOG_LEVEL to DEBUG and issue the command again? The error indicates that the Grafana server responded with something other than JSON, so it's likely a case where it can't reach the server (HUBOT_GRAFANA_HOST incorrect).

stephenyeargin commented 4 years ago

Possibly related to #91

fsckzy commented 4 years ago

Can you adjust your HUBOT_LOG_LEVEL to DEBUG and issue the command again? The error indicates that the Grafana server responded with something other than JSON, so it's likely a case where it can't reach the server (HUBOT_GRAFANA_HOST incorrect).

I regret that it is indeed a network problem, and now the robot can be used. Thank you