The TypeError indicates we may need to do some extra checking of the loaded-in Slack adapter, and possibly switch behavior if the uploadV2 method is not present.
Logs
{"level":20,"time":1721573681177,"pid":20,"hostname":"4a005511c918","name":"hubot","msg":"SlackClient#send() room: D03536NFP, message: Disk - [Slack files.upload Error: can't upload file] - https://orgname.grafana.net/d/nodes/?panelId=17&fullscreen&from=now-6h&to=now"}
{"level":20,"time":1721573687485,"pid":20,"hostname":"4a005511c918","name":"hubot","msg":"Uploading file: 6462 bytes, content-type[image/png]"}
{"level":50,"time":1721573687485,"pid":20,"hostname":"4a005511c918","name":"hubot","err":{"type":"TypeError","message":"this.robot.adapter.client.web.files.uploadV2 is not a function","stack":"TypeError: this.robot.adapter.client.web.files.uploadV2 is not a function\n at SlackUploader.upload (/opt/hubot/node_modules/hubot-grafana/src/adapters/implementations/SlackUploader.js:47:49)\n at Bot.sendDashboardChart (/opt/hubot/node_modules/hubot-grafana/src/Bot.js:118:27)\n at runMicrotasks (<anonymous>:null:null)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at Bot.sendDashboardChartFromString (/opt/hubot/node_modules/hubot-grafana/src/Bot.js:88:7)\n"},"msg":"SlackUploader.upload.uploadFile"}
{"level":20,"time":1721573687487,"pid":20,"hostname":"4a005511c918","name":"hubot","msg":"SlackClient#send() room: D03536NFP, message: Disk reads/writes - [Slack files.upload Error: can't upload file] - https://orgname.grafana.net/d/nodes/?panelId=18&fullscreen&from=now-6h&to=now"}
{"level":20,"time":1721573693787,"pid":20,"hostname":"4a005511c918","name":"hubot","msg":"Uploading file: 15423 bytes, content-type[image/png]"}
{"level":50,"time":1721573693787,"pid":20,"hostname":"4a005511c918","name":"hubot","err":{"type":"TypeError","message":"this.robot.adapter.client.web.files.uploadV2 is not a function","stack":"TypeError: this.robot.adapter.client.web.files.uploadV2 is not a function\n at SlackUploader.upload (/opt/hubot/node_modules/hubot-grafana/src/adapters/implementations/SlackUploader.js:47:49)\n at Bot.sendDashboardChart (/opt/hubot/node_modules/hubot-grafana/src/Bot.js:118:27)\n at runMicrotasks (<anonymous>:null:null)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at Bot.sendDashboardChartFromString (/opt/hubot/node_modules/hubot-grafana/src/Bot.js:88:7)\n"},"msg":"SlackUploader.upload.uploadFile"}
It looks like it's getting the image itself without issue, but running into trouble with a mismatch between the (now legacy) Slack adapter for Hubot and the @slack/web-api version. Not entirely sure what it should try to fall back to.
Describe the bug
When using with the listed versions, the script package is unable to Slack's file upload API.
To Reproduce
hubot graf db linux-node-fleet-overview
Expected behavior
The TypeError indicates we may need to do some extra checking of the loaded-in Slack adapter, and possibly switch behavior if the
uploadV2
method is not present.Logs
Software:
4.1.0
hubot-slack@4.10.0
/@slack/web-api@7.3.1
v16.20.2
8.19.4
Additional context
It looks like it's getting the image itself without issue, but running into trouble with a mismatch between the (now legacy) Slack adapter for Hubot and the
@slack/web-api
version. Not entirely sure what it should try to fall back to.