azure-functions-python-worker: [BUG] Azure function python v2 not visible in Azure Portal after deployment
Follow the steps mentioned in the document to deploy the function. https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-python?pivots=python-mode-decorators
Investigative information
Please provide the following:
- Timestamp: always happening
- Core Tools version: V1.2.0, through VS code extension
- VS code- 1.83.1
Repro steps
Provide the steps required to reproduce the problem:
- Follow steps as in above doc
- Create a blob trigger function
- add the below requirements.txt
- add the below to app.py
- test locally- runs perfectly!
- deploy to azure using VS code, right click “deploy to azure”, once successful - DOESNT SHOW IN PORTAL.
–>
Expected behavior
Provide a description of the expected behavior.
- The function should be visible on portal
- The function should be executed once blob is uploaded into the blob-storage
- Expected to work as it behaves on local.
Actual behavior
Provide a description of the actual behavior observed.
- Cannot find the function
- The function doesnt execute when the endpoint is hit
- the local test works but the deployed function doesnt
- fails in consumption plan
- fails in app service plan
Known workarounds
Provide a description of any known workarounds.
No workarounds
Contents of the requirements.txt file:
Provide the requirements.txt file to help us find out module related issues.
Files at the end
Related information
Provide any related information
- No specific source files except the two above
- Python version used - 3.9.13
- referred these but not helpful to fix the bug https://learn.microsoft.com/en-us/azure/azure-functions/machine-learning-pytorch?tabs=bash
- https://stackoverflow.com/questions/76458717/why-is-the-functions-runtime-not-finding-my-functions-when-i-import-certain-pack/76463210?noredirect=1#comment134830419_76463210
Source
import azure.functions as func
import logging
import os
#qdrant
from qdrant_client import QdrantClient
from qdrant_client.models import Distance, VectorParams,PointStruct
#encoder for vecotrizing embeddings
from sentence_transformers import SentenceTransformer
from langchain.document_loaders import PyPDFLoader
from langchain.document_loaders import DirectoryLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
#https://stackoverflow.com/questions/75627362/azure-functions-python-error-no-job-functions
app = func.FunctionApp()
@app.blob_trigger(arg_name="myblob", path="mycontainer",
connection="BlobStorageConnectionString")
def blob_trigger(myblob: func.InputStream):
logging.info(f"Python blob trigger function processed blob"
f"Name: {myblob.name}"
f"Blob Size: {myblob.length} bytes")
# DO NOT include azure-functions-worker in this file
# The Python Worker is managed by Azure Functions platform
# Manually managing azure-functions-worker may cause unexpected issues
azure-functions
-f https://download.pytorch.org/whl/torch_stable.html
torch==1.13.1+cpu
torchvision==0.14.1+cpu
torchaudio==0.13.1
sentence_transformers==2.2.2
langchain==0.0.274
qdrant_client==1.2.0
pypdf==3.9.0
Several customers reported this issue here, which was closed with no answer. https://github.com/Azure/azure-functions-python-worker/issues/1262 Please kindly look in and suggest.
Tagging you from the closed issue where the MS team hasn’t been responding. @Otimkev @andrewmmm @jsm-NK @aadamsx @JarroVGIT @SiddheshDesai06
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 35 (7 by maintainers)
Plus one.
It is very frustrating to debug issues that occur outside of the function definition.
For example, import errors, missing dependencies, or issues with the binding and trigger definitions.
We are essentially flying blind when trying to debug these problems.
Azure Functions should provide more access to logging that can lend a light to these issues.
Why was this issue closed while this clearly is an ongoing issue? Is there an other topic where we can follow the progress on this issue?
I had the same issue and found the actual error by opening
MyAzureFunction/Monitoring/Log Stream/Filesystem Logsand deploying the function.I saw an error that imports were broken even though VS code said deployment was “successful” and function did not appear. Fixed this error and now function appears.
EDIT:
Added more code and it no longer shows any other errors in that log stream and function does not appear…
I found the actual actual error by setting up WSL in VS code and running the function there. It immediately threw the error which azure eats up. It was a keras model which works in windows but doesn’t work in linux, I just re-saved this model using WSL, tested locally, and now functions appear in Azure.
Azure should just throw these errors instead of silencing them and saying that the deployment is successful…
TLDR: Use WSL to test your function locally
I am having similar issues where …
Tried all possible plans but none of seams to work. I am currently using Python 3.10 and V2 function. All logs in deployment center doesn’t show any error.
My requirement function is : azure-functions
@pdthummar that has worked, thank you!
Please can you advise how and where we can look up that failures?
@pdthummar Thank you, that seems to work now!
I used the VSCode-created blueprint.py unmodified; perhaps it would be good for the auto-generated example to not cause such errors. It did ask for both the blueprint filename and the new function name, so that’s arguably on me, but perhaps the sample could call the azure.functions.Blueprint object (and the decorator) FILE_bp or something like that just to minimize the chance of conflict.
In any case, indicating some kind of error during the deployment process would be great.
Also, both app.register_functions() and app.register_blueprint() seem to work; is there a different/preference?
Thanks again!