Closed fabge closed 1 month ago
Hi @fabge, thanks for reporting.
The correct streaming package is azurefunctions-extensions-http-fastapi
. azure-functions-extension-fastapi
shouldn't be referenced in the function app code or requirements.txt.
What was the error you were getting when using the from azurefunctions.extensions.http.fastapi import Request, StreamingResponse
import statement and including azurefunctions-extensions-http-fastapi
in your requirements.txt file?
Also, what version of Core Tools do you have? If you don't have the latest version (4.0.5907), can you try installing that? Some of the older versions might be out of date and not have support for this feature.
Thank you @hallvictoria for your response and good catch!
It seems like there is a copycat which pretends to publish your package under a similiar name:
https://pypi.org/project/azure-functions-extension-fastapi/
This is also why my code did not work. Following your explanation it worked instantly. We should probably report this! Looks like a classic dependency confusion attack, the version in the fake package is slightly higher than the original one... Also google rates the fake one a lot better, making the original one impossible to find if not searching explicitly in the pypi search.
Glad I could help!
Thanks for bringing awareness to the azure-functions-extension-fastapi
package. We'll take a look into it to prevent any further issues or confusion.
Thank you @hallvictoria for your response and good catch!
It seems like there is a copycat which pretends to publish your package under a similiar name:
https://pypi.org/project/azure-functions-extension-fastapi/
This is also why my code did not work. Following your explanation it worked instantly. We should probably report this! Looks like a classic dependency confusion attack, the version in the fake package is slightly higher than the original one... Also google rates the fake one a lot better, making the original one impossible to find if not searching explicitly in the pypi search.
sorry for this experimental legacy package causing any confusion @fabge. the package is removed now.
Expected Behavior
Setting
"PYTHON_ENABLE_INIT_INDEXING": "1"
and"PYTHON_ISOLATE_WORKER_DEPENDENCIES": "1"
as app settings, installing the latest azurefunctions-extensions-http-fastapi streaming library, and runningfunc start
should be successful.And i would expect the package import statements to work. The
from azurefunctions.extensions.http.fastapi import Request, StreamingResponse
which is mentioned here is completely wrong. It should befrom azure.functions.extension.fastapi import Request, StreamingResponse
Actual Behavior
When running locally, the app throws following exception
Exception: FunctionLoadError: cannot load the stream_count function: 'req' binding type "httpTrigger" and dataType "None" in function.json do not match the corresponding function parameter's Python type annotation "Request"
Steps to Reproduce
func start
Relevant code being tried
Relevant log output
requirements.txt file
Where are you facing this problem?
Local - Core Tools
Function app name
No response
Additional Information
No response