Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token u in JSON at position 0 #31

Closed
ryancabansag opened this issue Jul 19, 2017 · 2 comments
Closed

Unexpected token u in JSON at position 0 #31

ryancabansag opened this issue Jul 19, 2017 · 2 comments

Comments

@ryancabansag
Copy link

I get this error when im trying to message the bot

SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse ()
at _clone (somepath\BotlyBot\node_modules\botly\lib\Botly.js:575:17)
at Botly.handleMessage (somepath\BotlyBot\node_modules\botly\lib\Botly.js:494:18)
at router.post (somepath\BotlyBot\node_modules\botly\lib\Botly.js:99:18)
at Layer.handle [as handle_request] (somepath\BotlyBot\node_modules\express\lib\router\layer.
js:95:5)
at next (somepath\BotlyBot\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (somepath\BotlyBot\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (somepath\BotlyBot\node_modules\express\lib\router\layer.
js:95:5)
at somepath\BotlyBot\node_modules\express\lib\router\index.js:281:22
at Function.process_params (somepath\BotlyBot\node_modules\express\lib\router\index.js:335:12
)

@aellanglet
Copy link

Hello @ryancabansag , it's an issue concerning your webhook JSON response.
I had a problem like this at the beginning.
Try
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
before the
app.use("/webhook", botly.router());
(end of your app.js)
if i remember well it resolved the issue.
If it didn't , just look at the exemple (https://github.com/miki2826/botly/blob/master/example/app.js) or show me your code ! :)
I hope you will resolve this soon 👍

@ryancabansag
Copy link
Author

Thanks! Its working now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants