After some debugging found real reason for that behavior.
The botframework responds to activity, by only setting the code 200 ok. But body is None by default
await context.send_activity(
Activity(
type="invokeResponse",
value=InvokeResponse(status=HTTPStatus.OK),
)
)
botbuilder/dialogs/prompts/oauth_prompt.py:430
Here it's got body=invoke_response.value.body where body is None
return InvokeResponse(
status=invoke_response.value.status, body=invoke_response.value.body,
)
botbuilder/core/bot_framework_adapter.py:514
Then later in code this activity got dumped into json. And body=None becomes body=b'null'
See aiohttp.web_response.json_response
Looks like some bug ether in samples or in botframework.
Workaround is to prevent dumping None as null
# Listen for incoming requests on /api/messages
async def messages(req: Request) -> Response:
# Main bot message handler.
if "application/json" in req.headers["Content-Type"]:
body = await req.json()
else:
return Response(status=415)
activity = Activity().deserialize(body)
auth_header = req.headers["Authorization"] if "Authorization" in req.headers else ""
response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn)
if response:
# prevent sending None body as 'null'
if response.body is None:
args = {'status': response.status}
else:
args = {'data': response.body, 'status': response.status}
return json_response(**args)
return Response(status=201)