Starting from 4.15.0 - <Request POST /api/messages > has failed with exception: KeyError('access_token') · Issue #2105 · microsoft/botbuilder-python · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting from 4.15.0 version, when using MicrosoftAppCredentials(CONFIG.APP_ID, CONFIG.APP_PASSWORD).get_access_token() to send request to bot - now fails with <Request POST /api/messages > has failed with exception: KeyError('access_token').
Traceback (most recent call last):
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botbuilder/core/bot_adapter.py", line 174, in run_pipeline
return await self._middleware.receive_activity_with_status(
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botbuilder/core/middleware_set.py", line 69, in receive_activity_with_status
return await self.receive_activity_internal(context, callback)
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botbuilder/core/middleware_set.py", line 79, in receive_activity_internal
return await callback(context)
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botbuilder/core/activity_handler.py", line 70, in on_turn
await self.on_message_activity(turn_context)
File "/Users/someuser/someproj/app/bot/teams_conversation_bot.py", line 51, in on_message_activity
await self._text_message_handler.process_message(turn_context, text)
File "/Users/someuser/someproj/app/bot/handlers/text_message_handler.py", line 22, in process_message
await self._ms_teams_service.send_error_message(**locals())
File "/Users/someuser/someproj/app/bot/services/ms_teams_service.py", line 187, in send_error_message
await local_vars["turn_context"].send_activity(
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botbuilder/core/turn_context.py", line 173, in send_activity
result = await self.send_activities([activity_or_text])
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botbuilder/core/turn_context.py", line 225, in send_activities
return await self._emit(self._on_send_activities, output, logic())
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botbuilder/core/turn_context.py", line 303, in _emit
return await logic
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botbuilder/core/turn_context.py", line 220, in logic
responses = await self.adapter.send_activities(self, output)
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botbuilder/core/bot_framework_adapter.py", line 726, in send_activities
raise error
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botbuilder/core/bot_framework_adapter.py", line 711, in send_activities
response = await client.conversations.reply_to_activity(
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botframework/connector/aio/operations_async/_conversations_operations_async.py", line 523, in reply_to_activity
response = await self._client.async_send(
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/msrest/async_client.py", line 115, in async_send
pipeline_response = await self.config.pipeline.run(request, **kwargs)
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/msrest/pipeline/async_abc.py", line 159, in run
return await first_node.send(pipeline_request, **kwargs) # type: ignore
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/msrest/pipeline/async_abc.py", line 79, in send
response = await self.next.send(request, **kwargs) # type: ignore
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/msrest/pipeline/async_requests.py", line 99, in send
self._creds.signed_session(session)
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botframework/connector/auth/app_credentials.py", line 92, in signed_session
auth_token = self.get_access_token()
File "/Users/someuser/someproj/venv/lib/python3.10/site-packages/botframework/connector/auth/microsoft_app_credentials.py", line 54, in get_access_token
return auth_token["access_token"]
KeyError: 'access_token'
WARNING:root:Request <Request POST /api/messages > has failed with exception: KeyError('access_token')
Expected behavior
The request is received by the bot without any errors, as it was in 4.14.8 and below, without token issue
The text was updated successfully, but these errors were encountered:
vadym-kovryzhkin
added
bug
Indicates an unexpected problem or an unintended behavior.
needs-triage
The issue has just been created and it has not been reviewed by the team.
labels
May 2, 2024
Any update on this? This is exactly the error I am seeing on my infrastructure. However I have the same error regardless of the version. Checked 4.15.0, previous 4.14.8 and also 4.14.7.
Version
4.15.0
Describe the bug
Starting from 4.15.0 version, when using MicrosoftAppCredentials(CONFIG.APP_ID, CONFIG.APP_PASSWORD).get_access_token() to send request to bot - now fails with <Request POST /api/messages > has failed with exception: KeyError('access_token').
In 4.14.8 and below - it works fine.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The request is received by the bot without any errors, as it was in 4.14.8 and below, without token issue
The text was updated successfully, but these errors were encountered: