-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
The release of 1.12.0 introduced a feature:
- destination in webhook request (New field 'destination' in Webhook request #178).
However, when trying to verify the webhook URL in the developers console, the request body does not have a destination tag, as below:
{
"events": [
{
"replyToken": "00000000000000000000000000000000",
"type": "message",
"timestamp": 1561099010135,
"source": {
"type": "user",
"userId": "Udeadbeefdeadbeefdeadbeefdeadbeef"
},
"message": {
"id": "100001",
"type": "text",
"text": "Hello, world"
}
},
{
"replyToken": "ffffffffffffffffffffffffffffffff",
"type": "message",
"timestamp": 1561099010135,
"source": {
"type": "user",
"userId": "Udeadbeefdeadbeefdeadbeefdeadbeef"
},
"message": {
"id": "100002",
"type": "sticker",
"packageId": "1",
"stickerId": "1"
}
}
]
}Then a KeyErr will be evoked.
Traceback (most recent call last):
File "/home/ittsai/.local/share/virtualenvs/femhrad-linebot-QHVSuSA1/lib/python3.7/site-packages/flask/app.py", line 2311, in wsgi_app
response = self.full_dispatch_request()
File "/home/ittsai/.local/share/virtualenvs/femhrad-linebot-QHVSuSA1/lib/python3.7/site-packages/flask/app.py", line 1834, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/ittsai/.local/share/virtualenvs/femhrad-linebot-QHVSuSA1/lib/python3.7/site-packages/flask/app.py", line 1737, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/ittsai/.local/share/virtualenvs/femhrad-linebot-QHVSuSA1/lib/python3.7/site-packages/flask/_compat.py", line 36, in reraise
raise value
File "/home/ittsai/.local/share/virtualenvs/femhrad-linebot-QHVSuSA1/lib/python3.7/site-packages/flask/app.py", line 1832, in full_dispatch_request
rv = self.dispatch_request()
File "/home/ittsai/.local/share/virtualenvs/femhrad-linebot-QHVSuSA1/lib/python3.7/site-packages/flask/app.py", line 1818, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/ittsai/git/femhrad-linebot/callback.py", line 149, in callback
handler.handle(body, signature)
File "/home/ittsai/.local/share/virtualenvs/femhrad-linebot-QHVSuSA1/lib/python3.7/site-packages/linebot/webhook.py", line 235, in handle
payload = self.parser.parse(body, signature, as_payload=True)
File "/home/ittsai/.local/share/virtualenvs/femhrad-linebot-QHVSuSA1/lib/python3.7/site-packages/linebot/webhook.py", line 175, in parse
return WebhookPayload(events=events, destination=body_json['destination'])
KeyError: 'destination'
My callback server is base on line-bot-sdk-python/examples/flask-echo/app.py
I think this situation may be handled in the SDK level.
zarszz and okue
Metadata
Metadata
Assignees
Labels
No labels