slack-bot-api
slack-bot-api copied to clipboard
Error: SyntaxError: Unexpected token Y
Error: SyntaxError: Unexpected token Y
at /opt/agent/server/node_modules/slackbots/index.js:42:33
at Array.
Just using it
More Info
slack = new slackBot({
token: Config.slack.token,
name: 'Bot'
});
console.log('Slack starting');
slack.on('start', () => {
console.log('Slack started');
});
outputs
Slack starting
Error: SyntaxError: Unexpected token Y
at /opt/agent/server/node_modules/slackbots/index.js:42:33
at Array.<anonymous> (/opt/agent/server/node_modules/slackbots/node_modules/vow/lib/vow.js:754:56)
at Immediate.callFns [as _onImmediate] (/opt/agent/server/node_modules/slackbots/node_modules/vow/lib/vow.js:24:35)
at processImmediate [as _immediateCallback] (timers.js:396:17)
This happens in AWS when a new instance is brought up and runs the above code.
Recently just encountered this error too - not sure if it's the same reason, but I believe I was hitting the Slack rate limit / login error similar to #56 and #57 . Does it happen to you immediately when running your app, or after restarting it many times? After chilling for a couple minutes and restarting my app it seems fine.
This was because of the rate limit. Still... this library shouldn't crash when it gets a non-json response.