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:
  1. Follow steps as in above doc
  2. Create a blob trigger function
  3. add the below requirements.txt
  4. add the below to app.py
  5. test locally- runs perfectly!
  6. 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.
  1. The function should be visible on portal
  2. The function should be executed once blob is uploaded into the blob-storage
  3. Expected to work as it behaves on local.

Actual behavior

Provide a description of the actual behavior observed.
  1. Cannot find the function
  2. The function doesnt execute when the endpoint is hit
  3. the local test works but the deployed function doesnt
  4. fails in consumption plan
  5. 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
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)

Most upvoted comments

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.

@saikumaru We are actively addressing this matter to offer users more clarification on such issues. We will provide an update once we make progress on this. I am closing this issue for now. Thanks

@jmandivarapu If you are still facing the issue, please open new issue. Thanks

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 Logs and 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 …

  1. I deployed the python functions using VS code (It works and all the functions show up including all the files)
  2. Deploying using the Azure Devops - App files got updated but NO FUNCTIONS

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

openai[datalib]==0.28
azure-search-documents ==11.4.0b9
azure-storage-blob==12.14.1
cffi
markdown
pymongo
python-jose
six
tiktoken
msal

@pdthummar that has worked, thank you!

As a result of this compatibility issue, the worker is failing to index functions with below error, due to this, functions aren’t visible in the portal.

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!