Closed kummerer94 closed 1 year ago
Thanks for update will update on this asap.
@bp instance for which function instance created? is it from flask import Blueprint or some thing else pls specify
Ah, sorry, yes. This is the blueprint bp = func.Blueprint()
but I think you will also see the problem with @app
instead of @bp
.
can you share zip file for the same Thanks
from your error msg it suggest that the problem is with the issubclass() method, which expects the first argument to be a class. This indicates that the list class is not being recognized as a valid type for the output binding.
To fix this, you can try using typing.List[str] instead of list[str] for the output binding type annotation. This should resolve the error and allow you to use the correct type annotation for the output binding.
Here's an example of how to use typing.List[str] for the output binding type annotation: import logging import azure.functions as func import typing
def main(req: func.HttpRequest, outputQueueItem: func.Out[typing.List[str]]) -> func.HttpResponse: logging.info('Python HTTP trigger function processed a request.')
names = ["demo1", "demo2", "demo3"]
outputQueueItem.set(names)
return func.HttpResponse(f"Processed {len(names)} names.")
I hope this helps and Meanwhile you can share your solution with zip file.
@madhankumar1984 pls update with your file. Thanks
It is related to #1034 - Needs investigation.
@kummerer94 Currently the python worker does not support type hinting. We are working on getting that support in. Updates on this will be tracked in https://github.com/Azure/azure-functions-python-worker/issues/1034
Investigative information
Hi, I think the queue output binding does not yet play nice with the modern type declarations that are part of newer python models.
Repro steps
I tried using
func.Out[list[str]]
for my output binding instead offunc.Out[typing.List[str]]
and it gave me this error:I am using the new python programming model v2.
To reproduce this, I am using the following function:
Known workarounds
Right now, the workaround is to use the
List
class provided by thetyping
module. But more and more people are moving away from using thetyping
module because it is not necessary anymore.For now, it would also be great to make this error more descriptive as it took me some time to figure out what was going on.