Closed Deen12520 closed 7 years ago
Do you press the verify-button in the Developer Center?
This "Verify" means verifying SSL certificate. When you click this verify-button, LINE server sends a dummy webhook. And reply token included webhook is also dummy. So, it is impossible to call reply API.
Sorry, I can't get what you say. In fact, I have pressed the verity button. After I clicked the button,the "'500 INTERNAL SERVER ERROR'." occured.
There are something that I confused: 1. Can I use the code directly which I listed in my first problem?
I'm looking forward for your answers. Thanks a lot.
The errors like this:
2017-04-06T12:40:06.136826+00:00 heroku[router]: at=info method=POST path="/callback" host=line-bot-flaskr.herokuapp.com request_id=fdf96bda-17b9-4428-b60a-d353bee22a7a fwd="203.104.132.58" dyno=web.1 connect=1ms service=846ms status=500 bytes=456 protocol=https
2017-04-06T12:40:06.135006+00:00 app[web.1]: [2017-04-06 12:40:06,132] ERROR in app: Exception on /callback [POST]
2017-04-06T12:40:06.135017+00:00 app[web.1]: Traceback (most recent call last):
2017-04-06T12:40:06.135018+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
2017-04-06T12:40:06.135019+00:00 app[web.1]: response = self.full_dispatch_request()
2017-04-06T12:40:06.135020+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
2017-04-06T12:40:06.135020+00:00 app[web.1]: rv = self.handle_user_exception(e)
2017-04-06T12:40:06.135021+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
2017-04-06T12:40:06.135022+00:00 app[web.1]: reraise(exc_type, exc_value, tb)
2017-04-06T12:40:06.135023+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
2017-04-06T12:40:06.135023+00:00 app[web.1]: raise value
2017-04-06T12:40:06.135024+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
2017-04-06T12:40:06.135025+00:00 app[web.1]: rv = self.dispatch_request()
2017-04-06T12:40:06.135025+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
2017-04-06T12:40:06.135027+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args)
2017-04-06T12:40:06.135028+00:00 app[web.1]: File "/app/hello.py", line 32, in callback
2017-04-06T12:40:06.135028+00:00 app[web.1]: handler.handle(body, signature)
2017-04-06T12:40:06.135029+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/linebot/webhook.py", line 227, in handle
2017-04-06T12:40:06.135030+00:00 app[web.1]: func(event)
2017-04-06T12:40:06.135030+00:00 app[web.1]: File "/app/hello.py", line 43, in handle_message
2017-04-06T12:40:06.135031+00:00 app[web.1]: TextSendMessage(text=event.message.text))
2017-04-06T12:40:06.135032+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/linebot/api.py", line 94, in reply_message
2017-04-06T12:40:06.135032+00:00 app[web.1]: '/v2/bot/message/reply', data=json.dumps(data), timeout=timeout
2017-04-06T12:40:06.135033+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/linebot/api.py", line 262, in _post
2017-04-06T12:40:06.135034+00:00 app[web.1]: self.__check_error(response)
2017-04-06T12:40:06.135034+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/linebot/api.py", line 271, in __check_error
2017-04-06T12:40:06.135035+00:00 app[web.1]: raise LineBotApiError(response.status_code, error)
2017-04-06T12:40:06.135040+00:00 app[web.1]: linebot.exceptions.LineBotApiError: <LineBotApiError [Invalid reply token]>
2017-04-06T12:42:11.392731+00:00 heroku[router]: at=info method=POST path="/callback" host=line-bot-flaskr.herokuapp.com request_id=2447eb31-02b1-4964-8ccd-9eafeb9508 fwd="203.114.135.61" dyno=web.1 connect=1ms service=490ms status=500 bytes=456 protocol=https
2017-04-06T12:42:11.369481+00:00 app[web.1]: [2017-04-06 12:42:11,368] ERROR in app: Exception on /callback [POST]
2017-04-06T12:42:11.369497+00:00 app[web.1]: Traceback (most recent call last):
how to solve the problem? ## ERROR in app: Exception on /callback [POST]
@app.route("/callback", methods=['POST'])
def callback():
# get X-Line-Signature header value
signature = request.headers['X-Line-Signature']
# get request body as text
body = request.get_data(as_text=True)
app.logger.info("Request body: " + body)
# handle webhook body
try:
handler.handle(body, signature)
except InvalidSignatureError:
abort(400)
return 'OK'
I need your help. Thanks a lot.
You don't need to press verity button. I said thad this "Verify" means verifying SSL certificate.
Let's send a some text message to your BOT in LINE app. Then BOT may reply echo-text.
orz. I get it .
I try it. Thanks a lot.
When you press the verify button, LINE Server send a webhook.
But it is dummy.
Your server receive webhook and try to call Reply API.
But reply token is also dummy, so it failed...
Error log which you paste said "Invalid reply token".
2017-04-06T12:40:06.135040+00:00 app[web.1]: linebot.exceptions.LineBotApiError: <LineBotApiError [Invalid reply token]>
Thanks. :D
ok.
Thanks.
It doesn't matter whether you verify webhook url or not. My error comes from that I didn't clike the "confirm" on my mobile phone.
My problem is gone. @be-hase Thanks a lot.
Oh. It is good that the problem is gone. Thanks.
The webhook returned an invalid HTTP status code. (The expected status code is 200.)
same problem
Thank you be-hase.
I use the codes in my project directly and I deploy my project onHeroku successfully.
The codes what I use is:
But the error appeared like that:
https://intense-anchorage-90708.herokuapp.com/callback A http status of the response was '500 INTERNAL SERVER ERROR'.
I need your help. Thanks a lot.