cofacts / rumors-line-bot

Line bot that checks if a message contains internet rumor.
MIT License
76 stars 19 forks source link

[LINE Client] 400: Invalid reply token. #154

Open MrOrz opened 4 years ago

MrOrz commented 4 years ago

View details in Rollbar: https://rollbar.com/mrorz/rumors-line-bot/items/56/

[LINE Client] 400: Invalid reply token.
MrOrz commented 4 years ago

Steps to reproduce: Submit a big picture with lots of text. Chatbot will be busy doing OCR and by the time OCR finishes, chatbot's reply will be swallowed and there will be "invalid reply token" error.

From LINE messaging API doc:

Because the reply token becomes invalid after a certain period of time, responses should be sent as soon as a message is received. https://developers.line.biz/en/reference/messaging-api/#send-reply-message

It seems that the reply token is only available for 30-ish seconds. Replying beyond that time will raise such error, and from LINE user perspective, the chatbot reads the message but has no reply.

Similar encounter here: https://github.com/line/line-bot-sdk-python/issues/145#issuecomment-473805725

MrOrz commented 4 years ago

Fixed again by #157