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

[LINE Client] 400: A message (messages[1]) in the request body is invalid. #125

Open
MrOrz opened this issue Jan 21, 2019 · 8 comments · Fixed by #134
Open

[LINE Client] 400: A message (messages[1]) in the request body is invalid. #125

MrOrz opened this issue Jan 21, 2019 · 8 comments · Fixed by #134
Labels

Comments

@MrOrz
Copy link
Member

MrOrz commented Jan 21, 2019

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

[LINE Client] 400: A message (messages[1]) in the request body is invalid.
@MrOrz
Copy link
Member Author

MrOrz commented Jan 21, 2019

Making ratings to exceed 10 causes reply overlength

@MrOrz
Copy link
Member Author

MrOrz commented Feb 9, 2019

@MrOrz MrOrz added help wanted good first issue Picked for newcomers labels Feb 9, 2019
@MrOrz
Copy link
Member Author

MrOrz commented Feb 9, 2019

This happens quite frequently and is eating up our rollbar quota. Suggest to get it fixed soon.

@nonumpa nonumpa self-assigned this Feb 16, 2019
@MrOrz MrOrz added the bug label Mar 20, 2019
@nonumpa
Copy link
Member

nonumpa commented Apr 20, 2019

Error msg : [{"message": "size must be between 0 and 1000", "property": "template/actions/0/uri"}]

In PR #119
utils.js's function createArticleShareReply don't use ellipsis and it may create a message size longer than 1000.
But the reply contains uri if we ellipsis it, user click the button will get a wrong result. Need more discussion!

@MrOrz
Copy link
Member Author

MrOrz commented Apr 20, 2019

Let's truncate the user input reason before creating line:// URLs?

We can pick a length limit that is definitely safe (such as 100 words) so that it will not exceed the limit even after URL encoding.

nonumpa added a commit that referenced this issue May 4, 2019
…LINE Client] 400

A Chinese character creates 9 encoded characters, with article-url, queries, predefined words etc. reason size should be less than 100.
@MrOrz MrOrz closed this as completed in #134 May 4, 2019
MrOrz added a commit that referenced this issue May 4, 2019
Fix #125 [LINE Client] 400: A message (messages[1]) in the request body is invalid
@MrOrz
Copy link
Member Author

MrOrz commented May 20, 2019

看起來這次還有 reply 文字太長,導致無法查詢該則回應 orz

https://rollbar.com/mrorz/rumors-line-bot/items/54/occurrences/78068581282/
當 LINE bot 試圖顯示這個回應的時候,就會壞掉: https://cofacts.g0v.tw/reply/BWHDyGoBFV14knB4E2x8

@MrOrz MrOrz reopened this May 20, 2019
@nonumpa nonumpa removed their assignment May 22, 2019
@MrOrz
Copy link
Member Author

MrOrz commented Oct 22, 2019

訊息裡頭如果有「#」的話,似乎會被 LINE 判定為 invalid uri scheme⋯⋯
例:https://rollbar.com/mrorz/rumors-line-bot/items/59/occurrences/102203000877/

request.body:

{"replyToken":"5a0f8038d1234d32b8c77e0ca1ffc8f3","messages":[{"type":"text","text":"感謝您與其他 10 人的回饋。"},{"type":"template","altText":"📲 別忘了把上面的回應轉傳回您的聊天室,給其他人也看看!\n💁 若您認為自己能回應得更好,歡迎到 https://cofacts.g0v.tw/article/AV_JIY36yCdS-nWhujUU 提交新的回應唷!","template":{"type":"confirm","text":"📲 別忘了把上面的回應轉傳回您的聊天室,給其他人也看看!\n💁 若您認為自己能回應得更好,歡迎提交新的回應唷!","actions":[{"type":"uri","label":"分享給朋友","uri":"line://msg/text/?%E7%B6%B2%E8%B7%AF%E4%B8%8A%E6%9C%89%E4%BA%BA%E8%AA%AA%E3%80%8C#%E5%B0%8F%E5%BF%83%0A#%E5%9C%8B%E9%9A%9B%E7%B4%9A%E6%AF%92%E8%8D%89%E5%9C%A8%E5%8F%B0%E7%81%A3%E2%8B%AF%E2%8B%AF%E3%80%8D%20%E5%90%AB%E6%9C%89%E4%B8%8D%E5%AF%A6%E8%A8%8A%E6%81%AF%E5%96%94%EF%BC%81%0A%0A%E8%AB%8B%E8%87%B3%20https://cofacts.g0v.tw/article/AV_JIY36yCdS-nWhujUU%20%E7%9C%8B%E7%9C%8B%E9%84%89%E8%A6%AA%E5%80%91%E9%87%9D%E5%B0%8D%E9%80%99%E5%89%87%E8%A8%8A%E6%81%AF%E7%9A%84%E5%9B%9E%E6%87%89%E3%80%81%E7%90%86%E7%94%B1%EF%BC%8C%E8%88%87%E7%9B%B8%E9%97%9C%E7%9A%84%E5%87%BA%E8%99%95%E5%94%B7%EF%BC%81"},{"type":"uri","label":"提交新回應","uri":"https://cofacts.g0v.tw/article/AV_JIY36yCdS-nWhujUU"}]}}]}

result.details

[{"message": "invalid uri", "property": "template/actions/0/uri"}, {"message": "invalid uri scheme", "property": "template/actions/0/uri"}]

result.message

A message (messages[1]) in the request body is invalid

@MrOrz
Copy link
Member Author

MrOrz commented Oct 30, 2019

看起來應該是 hashtag 的問題,最近的 occurrence 都有 hashtag

https://rollbar.com/mrorz/rumors-line-bot/items/59/

ex:

line://msg/text/?%E7%B6%B2%E8%B7%AF%E4%B8%8A%E6%9C%89%E4%BA%BA%E8%AA%AA%E3%80%8C#%E5%B0%8F%E5%BF%83%0A#%E5%9C%8B%E9%9A%9B%E7%B4%9A%E6%AF%92%E8%8D%89%E5%9C%A8%E5%8F%B0%E7%81%A3%E2%8B%AF%E2%8B%AF%E3%80%8D%20%E5%90%AB%E6%9C%89%E4%B8%8D%E5%AF%A6%E8%A8%8A%E6%81%AF%E5%96%94%EF%BC%81%0A%0A%E8%AB%8B%E8%87%B3%20https://cofacts.g0v.tw/article/AV_JIY36yCdS-nWhujUU%20%E7%9C%8B%E7%9C%8B%E9%84%89%E8%A6%AA%E5%80%91%E9%87%9D%E5%B0%8D%E9%80%99%E5%89%87%E8%A8%8A%E6%81%AF%E7%9A%84%E5%9B%9E%E6%87%89%E3%80%81%E7%90%86%E7%94%B1%EF%BC%8C%E8%88%87%E7%9B%B8%E9%97%9C%E7%9A%84%E5%87%BA%E8%99%95%E5%94%B7%EF%BC%81

{"replyToken":"xxx","messages":[{"type":"text","text":"感謝您與其他 99 人的回饋。"},{"type":"template","altText":"📲 別忘了把上面的回應轉傳回您的聊天室,給其他人也看看!\n💁 若您認為自己能回應得更好,歡迎到 https://cofacts.g0v.tw/article/AV_JIY36yCdS-nWhujUU 提交新的回應唷!","template":{"type":"confirm","text":"📲 別忘了把上面的回應轉傳回您的聊天室,給其他人也看看!\n💁 若您認為自己能回應得更好,歡迎提交新的回應唷!","actions":[{"type":"uri","label":"分享給朋友","uri":"line://msg/text/?%E7%B6%B2%E8%B7%AF%E4%B8%8A%E6%9C%89%E4%BA%BA%E8%AA%AA%E3%80%8C#%E5%B0%8F%E5%BF%83%0A#%E5%9C%8B%E9%9A%9B%E7%B4%9A%E6%AF%92%E8%8D%89%E5%9C%A8%E5%8F%B0%E7%81%A3%E2%8B%AF%E2%8B%AF%E3%80%8D%20%E5%90%AB%E6%9C%89%E4%B8%8D%E5%AF%A6%E8%A8%8A%E6%81%AF%E5%96%94%EF%BC%81%0A%0A%E8%AB%8B%E8%87%B3%20https://cofacts.g0v.tw/article/AV_JIY36yCdS-nWhujUU%20%E7%9C%8B%E7%9C%8B%E9%84%89%E8%A6%AA%E5%80%91%E9%87%9D%E5%B0%8D%E9%80%99%E5%89%87%E8%A8%8A%E6%81%AF%E7%9A%84%E5%9B%9E%E6%87%89%E3%80%81%E7%90%86%E7%94%B1%EF%BC%8C%E8%88%87%E7%9B%B8%E9%97%9C%E7%9A%84%E5%87%BA%E8%99%95%E5%94%B7%EF%BC%81"},{"type":"uri","label":"提交新回應","uri":"https://cofacts.g0v.tw/article/AV_JIY36yCdS-nWhujUU"}]}}]}
--



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