Skip to content

Expired token caching issue #596

@EricDahlvang

Description

@EricDahlvang

Version

4.7.0

Describe the bug

I've deployed a bot, and a skill (80.skills-simple-bot-to-bot). Everything works great, until the token expires ... at which point, I'm getting an Unauthorized exception.

To Reproduce

Steps to reproduce the behavior:

  1. Deploy a Python Root bot and Skill bot
  2. Invoke the skill from the parent
  3. Leave everything sit for ? (i believe half an hour, but still investigating)
  4. Attempt to invoke the skill again
  5. See unauthorized error

Expected behavior

Tokens should automatically refresh, and expired tokens should not cause Unauthorized.

Additional context

2020-01-11T00:11:46.767987242Z �[40m�[32minfo�[39m�[22m�[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
2020-01-11T00:11:46.768032142Z Request starting HTTP/1.1 OPTIONS http://skillschildpython2.azurewebsites.net/api/messages
2020-01-11T00:11:46.807370521Z �[40m�[32minfo�[39m�[22m�[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
2020-01-11T00:11:46.807392521Z Request finished in 42.1837ms 400 application/json

2020-01-11T00:11:52.681874593Z
2020-01-11T00:11:52.681912392Z [on_turn_error] unhandled error: Operation returned an invalid status code 'Unauthorized'
2020-01-11T00:11:52.681919492Z [2020-01-11 00:11:52 +0000] [45] [ERROR] Error handling request
2020-01-11T00:11:52.681924292Z Traceback (most recent call last):
2020-01-11T00:11:52.681928792Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/bot_adapter.py", line 103, in run_pipeline
2020-01-11T00:11:52.681933692Z context, callback
2020-01-11T00:11:52.681938092Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/middleware_set.py", line 69, in receive_activity_with_status
2020-01-11T00:11:52.681942992Z return await self.receive_activity_internal(context, callback)
2020-01-11T00:11:52.681947492Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/middleware_set.py", line 79, in receive_activity_internal
2020-01-11T00:11:52.681952092Z return await callback(context)
2020-01-11T00:11:52.681956492Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/activity_handler.py", line 28, in on_turn
2020-01-11T00:11:52.681961092Z await self.on_message_activity(turn_context)
2020-01-11T00:11:52.681965392Z File "/home/site/wwwroot/bots/echo_bot.py", line 21, in on_message_activity
2020-01-11T00:11:52.681969992Z MessageFactory.text(f"Echo (python): {turn_context.activity.text}")
2020-01-11T00:11:52.681974592Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 165, in send_activity
2020-01-11T00:11:52.681979192Z result = await self.send_activities([activity_or_text])
2020-01-11T00:11:52.681983592Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 198, in send_activities
2020-01-11T00:11:52.681988192Z return await self._emit(self._on_send_activities, output, logic())
2020-01-11T00:11:52.681992591Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 276, in _emit
2020-01-11T00:11:52.682002891Z return await logic
2020-01-11T00:11:52.682007391Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 193, in logic
2020-01-11T00:11:52.682011791Z responses = await self.adapter.send_activities(self, output)
2020-01-11T00:11:52.682016091Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/bot_framework_adapter.py", line 444, in send_activities
2020-01-11T00:11:52.682020491Z raise error
2020-01-11T00:11:52.682024591Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/bot_framework_adapter.py", line 431, in send_activities
2020-01-11T00:11:52.682028991Z activity.conversation.id, activity.reply_to_id, activity
2020-01-11T00:11:52.682033291Z File "/antenv/lib/python3.7/site-packages/botframework/connector/aio/operations_async/_conversations_operations_async.py", line 533, in reply_to_activity
2020-01-11T00:11:52.682038791Z raise models.ErrorResponseException(self._deserialize, response)
2020-01-11T00:11:52.682043191Z botbuilder.schema._models_py3.ErrorResponseException: Operation returned an invalid status code 'Unauthorized'
2020-01-11T00:11:52.682047491Z
2020-01-11T00:11:52.682051491Z During handling of the above exception, another exception occurred:
2020-01-11T00:11:52.682055791Z
2020-01-11T00:11:52.682059791Z Traceback (most recent call last):
2020-01-11T00:11:52.682063891Z File "/antenv/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
2020-01-11T00:11:52.682068191Z resp = await task
2020-01-11T00:11:52.682072491Z File "/antenv/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
2020-01-11T00:11:52.682076891Z resp = await handler(request)
2020-01-11T00:11:52.682080991Z File "/home/site/wwwroot/app.py", line 84, in messages
2020-01-11T00:11:52.682085290Z raise exception
2020-01-11T00:11:52.682105290Z File "/home/site/wwwroot/app.py", line 81, in messages
2020-01-11T00:11:52.682109590Z await ADAPTER.process_activity(activity, auth_header, BOT.on_turn)
2020-01-11T00:11:52.682113790Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/bot_framework_adapter.py", line 267, in process_activity
2020-01-11T00:11:52.682117990Z await self.run_pipeline(context, logic)
2020-01-11T00:11:52.682121890Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/bot_adapter.py", line 107, in run_pipeline
2020-01-11T00:11:52.682125990Z await self.on_turn_error(context, error)
2020-01-11T00:11:52.682129790Z File "/home/site/wwwroot/app.py", line 44, in on_error
2020-01-11T00:11:52.682133690Z await context.send_activity("The bot encountered an error or bug.")
2020-01-11T00:11:52.682137790Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 165, in send_activity
2020-01-11T00:11:52.682141890Z result = await self.send_activities([activity_or_text])
2020-01-11T00:11:52.682147890Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 198, in send_activities
2020-01-11T00:11:52.682151990Z return await self._emit(self._on_send_activities, output, logic())
2020-01-11T00:11:52.682156090Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 276, in _emit
2020-01-11T00:11:52.682160090Z return await logic
2020-01-11T00:11:52.682163790Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 193, in logic
2020-01-11T00:11:52.682167790Z responses = await self.adapter.send_activities(self, output)
2020-01-11T00:11:52.682171790Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/bot_framework_adapter.py", line 444, in send_activities
2020-01-11T00:11:52.682175790Z raise error
2020-01-11T00:11:52.682179589Z File "/antenv/lib/python3.7/site-packages/botbuilder/core/bot_framework_adapter.py", line 431, in send_activities
2020-01-11T00:11:52.682183989Z activity.conversation.id, activity.reply_to_id, activity
2020-01-11T00:11:52.682187989Z File "/antenv/lib/python3.7/site-packages/botframework/connector/aio/operations_async/_conversations_operations_async.py", line 533, in reply_to_activity
2020-01-11T00:11:52.682192089Z raise models.ErrorResponseException(self._deserialize, response)
2020-01-11T00:11:52.682196089Z botbuilder.schema._models_py3.ErrorResponseException: Operation returned an invalid status code 'Unauthorized'

[bug]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions