azure-functions-python-worker
azure-functions-python-worker copied to clipboard
[Bug] raise ValueError('Enum {} has no value defined for name {!r}'.format(
Investigative information
Repro steps
Provide the steps required to reproduce the problem:
Example:
- Create a FN App with below code:```
import azure.functions as func
#import os
import pinecone
from FastAPIApp import app # Main API application
@app.get("/hello/{name}")
async def get_name(name: str):
return {
"name": name,
}
def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
"""
Azure function entry point.
All web requests are handled by FastAPI.
Args:
req (func.HttpRequest): Request
context (func.Context): Azure Function Context
Returns:
func.HttpResponse: HTTP Response
"""
return func.AsgiMiddleware(app).handle(req, context)
- Make a get requet to /hello/name
Then I get in the console all this:
For detailed output, run func with --verbose flag.
[2023-07-03T07:07:13.895Z] Worker process started and initialized.
[2023-07-03T07:07:16.990Z] Host lock lease acquired by instance ID '000000000000000000000000C65794F3'.
[2023-07-03T07:07:22.001Z] Executing 'Functions.WrapperFunction' (Reason='This function was programmatically called via the host APIs.', Id=45e30e54-5f77-4086-ad8f-a01f33a81552)
[2023-07-03T07:07:25.791Z] Worker failed to load function: 'WrapperFunction' with functionId: 'a58c4a21-c0de-4584-aabb-a18821794d7e'.
[2023-07-03T07:07:25.792Z] Result: Failure
Exception: ValueError: Enum RpcLogCategory has no value defined for name 'System'
Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.10/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 394, in _handle__function_load_request
logger.info('Successfully processed FunctionLoadRequest, '
File "C:\Users\xx\anaconda3\lib\logging\__init__.py", line 1477, in info
self._log(INFO, msg, args, **kwargs)
File "C:\Users\xx\anaconda3\lib\logging\__init__.py", line 1624, in _log
self.handle(record)
File "C:\Users\xx\anaconda3\lib\logging\__init__.py", line 1634, in handle
self.callHandlers(record)
File "C:\Users\xx\anaconda3\lib\logging\__init__.py", line 1696, in callHandlers
hdlr.handle(record)
File "C:\Users\xx\anaconda3\lib\logging\__init__.py", line 968, in handle
self.emit(record)
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.10/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 821, in emit
Dispatcher.current.on_logging(record, msg)
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.10/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 206, in on_logging
log_category = protos.RpcLog.RpcLogCategory.Value('System')
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.10/WINDOWS/X64\google\protobuf\internal\enum_type_wrapper.py", line 73, in Value
raise ValueError('Enum {} has no value defined for name {!r}'.format(
.
[2023-07-03T07:07:25.824Z] Executed 'Functions.WrapperFunction' (Failed, Id=45e30e54-5f77-4086-ad8f-a01f33a81552, Duration=3838ms)
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.10/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 206, in on_logging
log_category = protos.RpcLog.RpcLogCategory.Value('System')
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.10/WINDOWS/X64\google\protobuf\internal\enum_type_wrapper.py", line 73, in Value
raise ValueError('Enum {} has no value defined for name {!r}'.format(
.
Contents of the requirements.txt file:
azure-functions>=1.12.0 fastapi langchain pinecone-client azure-storage-blob openai pyodbc azure-identity azure-keyvault-secrets pydantic
Thanks for reporting the issue pls share the proper code snipped which you tried.
the code its on the question, I only imported pinecone and it breaks everything if I remove import pinecone it works
pip install pinecone-client
then import pinecone
without even calling any pinecone method, just the import
also reported here, not sure which team should follow: https://github.com/Azure/azure-functions-core-tools/issues/3399
@vrdmr pls comment and validate as of now pinecore lib not working.
I was able to isolate the problem and it seems related to Conda Environments. When using conda environments on vs code the problem appears.
When using venv instead the problem is gone.