Skip to content

Argument cannot be assigned to parameter "app" of type "Framework" in function "serve" #112

@danielniccoli

Description

@danielniccoli

The following sample code generates a warning.

from hypercorn.config import Config
from hypercorn.asyncio import serve
import asyncio
import restate

from app.greeter import greeter

app = restate.app(services=[greeter])


def main():
    """Entry point for running the app."""
    conf = Config()
    conf.bind = ["0.0.0.0:9080"]
    asyncio.run(serve(app, conf)) # This line causes the below warning.
#                     ~~~

if __name__ == "__main__":
    main()
Argument of type "((RestateLambdaRequest, Any) -> RestateLambdaResponse) | ((scope: Scope, receive: Receive, send: Send) -> CoroutineType[Any, Any, None])" cannot be assigned to parameter "app" of type "Framework" in function "serve"
  Type "((RestateLambdaRequest, Any) -> RestateLambdaResponse) | ((scope: Scope, receive: Receive, send: Send) -> CoroutineType[Any, Any, None])" is not assignable to type "Framework"
    Type "(RestateLambdaRequest, Any) -> RestateLambdaResponse" is not assignable to type "Framework"
      Type "(RestateLambdaRequest, Any) -> RestateLambdaResponse" is not assignable to type "ASGIFramework"
        Function accepts too many positional parameters; expected 2 but received 3
          Parameter 1: type "Scope" is incompatible with type "RestateLambdaRequest"
          Function return type "RestateLambdaResponse" is incompatible with type "Awaitable[None]"
      Type "(RestateLambdaRequest, Any) -> RestateLambdaResponse" is not assignable to type "WSGIFramework"
        Parameter 1: type "dict[Unknown, Unknown]" is incompatible with type "RestateLambdaRequest"
  ...

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