slack-bot-api icon indicating copy to clipboard operation
slack-bot-api copied to clipboard

Error: SyntaxError: Unexpected token Y

Open rick-rheo opened this issue 7 years ago • 3 comments

Error: SyntaxError: Unexpected token Y at /opt/agent/server/node_modules/slackbots/index.js:42:33 at Array. (/opt/agent/server/node_modules/slackbots/node_modules/vow/lib/vow.js:754:56)

Just using it

rick-rheo avatar May 26 '17 02:05 rick-rheo

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.

rick-rheo avatar May 26 '17 21:05 rick-rheo

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.

bryjch avatar Jun 06 '17 16:06 bryjch

This was because of the rate limit. Still... this library shouldn't crash when it gets a non-json response.

rick-rheo avatar Jun 06 '17 16:06 rick-rheo