The following code:
const Slack = require('slack');
const fs = require('fs');
const token = 'super-secret-token-my-brah';
const slack = new Slack({ token });
slack.files.upload({
channel: 'general',
file: fs.createReadStream(__dirname + '/test.jpg'),
})
.then(console.log)
.catch(console.error);
Is giving me the following error:
Error: no_file_data
at _res (/Users/myname/Desktop/repos/myapp/node_modules/slack/src/_exec.js:56:17)
at IncomingMessage.__end (/Users/myname/Desktop/repos/myapp/node_modules/tiny-json-http/_write.js:75:9)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1056:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
The file is present at the path given, so that's not the problem. I've been searching through the Slack documentation and everything, but no leads.
Anyone have any idea what's happening here?