Skip to content

Typing for Middleware is incorrect #2198

Open
@heyitsaamir

Description

@heyitsaamir

Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Version

4.16.2

Describe the bug

The typing for the middleware on_turn handler is:

def on_turn(self, context: TurnContext, logic: Callable[[TurnContext], Awaitable]):

Notice the arguments is a TurnContext?

However, it's called like:

async def call_next_middleware():
return await self.receive_activity_internal(
context, callback, next_middleware_index + 1
)
try:
return await next_middleware.on_turn(context, call_next_middleware)
.

Here call_next_middleware takes no arguments.

This results in:

TypeError: MiddlewareSet.receive_activity_internal.<locals>.call_next_middleware() takes 0 positional arguments but 1 was given

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or an unintended behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @tracyboehrer@heyitsaamir@gandiddi

    Issue actions

      Typing for Middleware is incorrect · Issue #2198 · microsoft/botbuilder-python