Open SiddheshDesai06 opened 1 year ago
Did this problem start recently?
I had a v2 programming function app deployed that was working fine, however last night i made some changes and I can no longer see the functions. I've tried everything and attempting to revert to the old code but I can't seem to see what is different.
Maybe Azure have made some changes that have impacted us?
@VirajVaitha123 thanks for informing and can you share the function name,region,invocationid etc. So I can investigate same at our end.
I'm the author of the SO question and wanted to add that I found this issue only applies when deploying to a consumption plan. When I deploy to a dedicated app service plan, the functions load.
@VirajVaitha123 thanks for informing and can you share the function name,region,invocationid etc. So I can investigate same at our end.
Sure
function name : scryptifyf1 region: north europe, invocationid: (I can't find this)..
@VirajVaitha123 Thanks for input I will update once check
Thanks for looking into this.
Do we know if this problem is one multiple people are facing, and there is nothing we can do to deploy with Python v2 programming model?
@VirajVaitha123 pls share the start time and end time
I have been experiencing the exact same issue for over a week - I have tried the different deployment methods, as well as deleting and recreating the Function App and App Service Plan.
Only workaround I know is to switch to the V1 programming model.
@gavin-aguiar pls comment
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
I'm experiencing a similar issue but with two differences:
One additional thing I've noticed when I've probed around in my portal is that Genie is reporting the following error:
Worker failed to index functions
Result: Failure Exception: ImportError: cannot import name '_imaging' from 'PIL' (/home/site/wwwroot/.python_packages/lib/site-packages/PIL/init.py). Troubleshooting Guide: https://aka.ms/functions-modulenotfound Stack: File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py', line 338, in _handle__functions_metadata_request fx_metadata_results = self.index_functions(function_path) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py', line 607, in index_functions indexed_functions = loader.index_function_app(function_path) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 48, in call raise extend_exception_message(e, message) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 44, in call return func(*args, **kwargs) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/loader.py', line 151, in index_function_app imported_module = importlib.import_module(module_name) File '/usr/local/lib/python3.10/importlib/init.py', line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File '', line 1050, in _gcd_import File '', line 1027, in _find_and_load File '', line 1006, in _find_and_load_unlocked File '', line 688, in _load_unlocked File '', line 883, in exec_module File '', line 241, in _call_with_frames_removed File '/home/site/wwwroot/function_app.py', line 2, in from core.data.training_image_filestore import TrainingImageFilestore File '/home/site/wwwroot/core/data/training_image_filestore.py', line 1, in from PIL import Image File '/home/site/wwwroot/.python_packages/lib/site-packages/PIL/Image.py', line 103, in from . import _imaging as core
That is followed by this error:
No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
The key thing that strikes me as odd here is that it's failing to import the package from /home/site/wwwroot/.python_pacakages/...
Looking in my storage account, the reason it's failing is obvious - there's no .python_packages file in wwwroot.
After liaising with the OP of this github issue on my own SO post, we're using identical Azure Pipeline YAML definitions. The key thing is we're both running from zip packages, rather than deploying the code directly so I wouldn't expect there to be anything in wwwroot.
Since my function_app.py file imports a load of custom packages (which in turn import PIL), and does so before declaring the function, my thinking is that the imports are erroring about because Python should be looking for them in the package but is actually looking for them in the site root (working directory). Since they aren't there, it errors out so never makes it as far as far as the function app declaration.
Just a guess but given the errors it would make sense.
What to do about that, however, I don't know!
For now it looks like the two workarounds are:
I followed the first of these options and this resolved my issue.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
I'm facing the same challenge over here using python. The Function HTTP triggers are not visible in Functions section of Function tab but files are visible in App files.
@bhagyshricompany Can you take a look at this issue? I see multiple customers facing this issue?
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
This is still an issue, I am seeing it happen on occasion. As of yet cannot figure out a pattern for why it happens or how to fix it.
@bhagyshricompany Can you check this issue? Looks like its a bug, Multiple customers are reporting it?
Can you reproduce it on your end with the code in the question? with python function v2? The trigger won't be visible in the portal despite all the solutions in v2. It works in v1
Surprisingly what worked for me, was creating a new venv, installing pip requirements and testing the app still works.
Sometimes, the Azure Functions Compute may find a conflict with packages too, and you won't even know. So making certain packages == version in requirements can help.
Finally, don't just export your requirements.txt. As this returns a huge list of requirements. write the names as you install them.
It's surprising azure don't show an error message, instead just hides the functions in the UI.
What I am seeing is this log:
[Information] 1 functions found
[Information] 0 functions loaded
And the app function doesn't appear in the functions tab, but the file do appear under app files. The exact same python code deployed to a different environment is working fine.
I had a similar issue, my Azure Function worked perfectly in local testing. Deployment was succesful, but no triggers were shown. I could not find any logs showing any errors at all.
I downgraded to the v1 python worker based on the discussion in this thread. Using the v1 worker, the trigger was created, but I could see it generated an error when trying to import the psycopg2
package, changing the requirements.txt to use psycopg2-binary
fixed this issue. Retrying the v2 python worker using the psycopg2-binary
package worked and the trigger showed up succesfully. I think this is similar to the issue @VirajVaitha123 was experiencing.
It appears the v2 worker doesn't show an error message and doesn't create the trigger where the v1 worker does.
I am having the same issue with my functions no showing/loading. Everything works locally & debugging but when pipelines or vscode deploys to the function it succeeds but never shows any functions.
I am also experiencing the issue. Local running works fine but deployment using VSCode and the CLI result in no functions being shown in the Azure Portal with no error messages being thrown.
I am experiencing this issue as well. I have a python function app with which I would like to use the v2 programming model. Tests succeed locally. However, when I deploy my code to the function app with the cli, the build succeeds but no triggers are listed (there is one ServiceBusTrigger in the app). I narrowed it down to the single import of my own code that I have in function_app.py (from game_ingestor.core.ingest import GameIngestor
). If I remove the import (as a result the trigger does nothing with the messages it receives), and deploy the code with the cli the trigger is visible. I tried changing the code to adopt the V1 model with the imports. Under the V1 model, my deployments with the cli behave as expected, with the single trigger listed.
I am also experiencing the issue. 🙅
Also experiencing this issue. Like others, the logs only show this:
[Information] 1 functions found [Information] 0 functions loaded
The files are present, deployments all succeed, and there are no errors in the logs. Running absolutely fine in another region in a function with same code, build steps & app config values.
Running on a P1:V3 app plan.
I was able to resolve this issue. I had to remove any code in my function_app.py
file and blueprint.py
file that was above my function definition, apart from imports and initializing the FunctionApp or Blueprint objects.
I an facing the exact same issue. My function works in V1 version, but with V2 it works in local, but cannot see the function when deployed. I am deploying from VSCode to Serverless. @robmitchellzone Will you please give us a bit more details of the fix that worked for you.
@shahztechfarm, I had variables declared above my function definition in my blueprint.py
file. Moving those statements to within the function allowed Azure to detect the function when deployed to the cloud.
Thank you @robmitchellzone We followed the same and we are now able to deploy and execute our V2 functions.
I am also facing the issue and just tried the method proposed by @robmitchellzone.
Code then looks something like that
... Imports ...
app = func.FunctionApp()
@app.function_name(name="mytimer")
@app.schedule(schedule="0 0 */6 * * *", arg_name="mytimer", run_on_startup=True)
def main(mytimer: func.TimerRequest) -> None:
# Non-main functions were moved to inner functions
def get_project_json():
devops_access_token = os.environ['DEVOPS_READ_TOKEN']
Still, host log says: 2023-09-19T08:24:23.828 [Information] 1 functions found (Custom) 2023-09-19T08:24:23.828 [Information] 0 functions loaded
Code works fine when deploying from local.
Why is this ticket closed? I am still seeing this issue. Is Microsoft intending to fix this?
Just adding also having the same issue, Indexing is set and fixes as mentioned above but still the functions don't appear in the Azure Portal. If i use consumption plan its more reliable, but if i use a dedicate ASE its much more of an issue.
Hi All - I had exactly the same issue. Locally everything runs fine but when deploying to ASP I cannot see the functions.
After I removed ALL the imports (expect for azure.functions) from beginning of the file and added the imports under the method(s) that used them, then it started to work.
So DONT do it like this:
Still having this issue. Also I'm trying to implement Azure Durable functions as well. I connect with FTP and confirm that the /home/data/SitePackages has been updated after deploying from Github actions. The logs claim a succesfull deployment but no files/functions are detected by Azure. (Python v2)
I'm on EP1:3 service plan. This really is a critical issue to solve.
I just ran into this issue today. Tried moving everything into the function and outside the function. Tried upgrading my plan. Tried deploying from VSCode, az publish, github actions. Nothing worked. Runs fine locally (func start).
Can see with publish the http trigger never syncs:
Deployment successful. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Extract zip. Remote build. Remote build succeeded! Syncing triggers... Functions in af-ah-roles:
I solved this issue by adding the following to my requirements.txt
so you're saying it was a dependency issue for you?
Correct. I ran I to a smililar issue in a python v1 app last year. I forgot that I had to add that dependency again. Apparently v4 of the protobuf package had breaking changes.
Yes, for me it was the function definition was slightly off. I think if we got better feedback (or any) from the tools we could solve this without as much guess work.
For whomever comes here in utter despair like I did; I've created a demo on when this issue occurs. With 'issue' I am pointing at the situation where a FunctionApp is successfully deployed but the Functions themselves don't show up.
In essence, the problem lies in the code base (duh). If there is any error while loading your project, then Azure Functions will silence that and instead just won't show any of the Functions in your Function app. It's extremely hard to debug, as you have absolutely no idea what is going wrong. You can even get into the situation where it works locally, but not on Azure Functions. A possible cause for that is that you are testing it locally on a different OS (Windows for example) than where it will be deployed (Linux), and you are doing a *zip-deployment where the packages you zipped, contain Windows-specific binaries.
I am not saying this is specifically the case if you run in this issue. I am saying this is an example of an issue that is kept silence by Azure Functions so you can go down a completely unrelated rabbit hole.
The reproduction is here (https://github.com/JarroVGIT/azure-functions-python-v2-load-issue), with examples when it will and will not work. Hope it helps somebody save a day or two ;)
Very much useful, thank you for the insight @JarroVGIT. My python code would execute on the local host, but the function would never pop up in Azure, in spite of a successful deployment. Logs were basically limited to "Function Found: 1, Function Loaded: 0". After hours of troubleshooting, I simply realized that I'd set psycopg2 as a requirement instead of psycopg2-binary (pg engine driver, and of course postgres was not readily available as a binary on the Service Plan). It is highly confusing for a dev as Azure reported the Function deployment as successful, and not a single error or warning was logged.
@gavin-aguiar - please can you look at this issue and reopen? It has been pending since 4 months!
@SiddheshDesai06 - please can you kindly re-open and comment on this issue so that the engineers can keep researching.
@bhagyshricompany It looks like many customer's are facing this issue? Can you check this and try to acknowledge the issue?
@bhagyshricompany Any update?
I'm not sure if MS is looking at this issue, which is kind of sad. I have opened a new issue here to track- https://github.com/Azure/azure-functions-python-worker/issues/1338
Still having this issue. Also I'm trying to implement Azure Durable functions as well. I connect with FTP and confirm that the /home/data/SitePackages has been updated after deploying from Github actions. The logs claim a succesfull deployment but no files/functions are detected by Azure. (Python v2)
I'm on EP1:3 service plan. This really is a critical issue to solve.
Allright, so for everyone having this issue i suggest going through all your requirements file.
Details: As soon as you include a module thats already a part of the python base module - your code will fucntion localy, but when you deploy it to azure no files will even show up. This is reproducale, and no error/debuing feedback will be provided when such a mistake has been done. I myself fell for this, as its just normal practice for me to include libraries/modules in requirements out of habbit when using/testing new ones. I suggest this is producint a lot of the issues many people here have.
All I have in my requirements.txt is azure-functions, and still getting it.
@charlesjankowski - Can you share your app name for us to investigate?
Refer this SO Thread and my answer - https://stackoverflow.com/questions/76458717/why-is-the-functions-runtime-not-finding-my-functions-when-i-import-certain-pack/76463210?noredirect=1#> The Azure python Function with V2 programming model including external packages and imports in function_app.py works locally, But when I deploy it in Azure the Function Trigger is not visible. If I deploy default HTTP Trigger with python v2 programming model, The trigger is visible after deployment. But not when i add custom imports in the function_app.py and requirements.txt. Refer this image - https://i.imgur.com/CjCnsY8.png but the function files are visible in app files like here- https://i.imgur.com/R3SZWcW.png . I tried the deployment with App service plan and consumption plan both, Still no luck. I also added AzureWebJobsFeatureFlags:EnableWorkerIndexing settings, I also tried to deploy this function as zip using azure cli zip command with required settings to deploy function as zip, I also tried to deploy it with function core tools func azure functionapp publish command and also via VS code still no luck.
Investigative information
Please provide the following:
Repro steps
Provide the steps required to reproduce the problem:
Refer this SO thread and my answer- https://stackoverflow.com/questions/76458717/why-is-the-functions-runtime-not-finding-my-functions-when-i-import-certain-pack/76463210?noredirect=1#comment134830419_76463210
Expected behavior
Provide a description of the expected behavior.
after deployment HTTP trigger should be visible in Azure portal
Actual behavior
Provide a description of the actual behavior observed.
Function trigger is not visible in Functions section of Function tab but files are visible in app files
Known workarounds
Provide a description of any known workarounds.
Contents of the requirements.txt file:
Provide the requirements.txt file to help us find out module related issues.
numpy
pandas
opencv-python-headless
librosa
torch
torchaudio
torch-audiomentations
torchvision
azure-functions
Related information
Provide any related information
https://stackoverflow.com/questions/76458717/why-is-the-functions-runtime-not-finding-my-functions-when-i-import-certain-pack/76463210?noredirect=1#comment134830419_76463210