-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure function python v2 with external packages HTTP Trigger not visible in Azure Portal after deployment #1262
Comments
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. |
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. |
Sure function name : scryptifyf1 |
@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:
That is followed by this error:
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? |
[like] Joe Plumb reacted to your message:
…________________________________
From: William Harding ***@***.***>
Sent: Monday, June 10, 2024 4:44:55 PM
To: Azure/azure-functions-python-worker ***@***.***>
Cc: Joe Plumb ***@***.***>; Manual ***@***.***>
Subject: Re: [Azure/azure-functions-python-worker] Azure function python v2 with external packages HTTP Trigger not visible in Azure Portal after deployment (Issue #1262)
I'm going to point out also, that this a great example of an issue that you would see in a python deployment, but wouldn't in a .net app. This is because the .net function will fail when compiled so you would always know right away. The python functions deployment just zips it all up and ships it to the function. It won't know that there is an issue until the function app is loaded up.
That's probably the right way to do a python deployment from the Azure side, even though it does create an issue. The only real improvement would be that if the app fails to run once uploaded, that there is a link to the error and to have it on the main page. That would, at least, get you troubleshooting faster.
—
Reply to this email directly, view it on GitHub<#1262 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGHHAQKPSQDEYBBDRPAL5BDZGXJYPAVCNFSM6AAAAAAZFINADGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJYHA2DSMZYGY>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Anyone got it working? |
@SjoerdTimovanVliet, yes, with the changes I've mentioned above (though I've opted for the latest version rather than v2). Please see the installation guidance at https://www.psycopg.org/install/ |
I am trying to deploy a function app using the Flex Consumption plan. I have tried using the v1 model, v2 model, and reverted back to the simple HttpExample with no external python modules, yet I still do not see any of my http triggers. I am correctly using the WEBSITE_RUN_FROM_PACKAGE environment variable and have it linked to the blob of the zip containing the function app code. I manually sync the triggers as part of my deployment pipeline as well. I have tried everything that @JackDDavis tried + more, and currently have no external modules, yet I still see nothing. In the trace logs I get |
I wrote a more comprehensive troubleshooting guide. But, there isn't much else I can do without seeing your code. even with the Flex plan, you should still be able to access the diagnostic tools. |
@BillmanH I switched my function app code to mimic the HttpExample template so that I would know if its a module error:
I still cannot see this simple trigger in the function app. After reading this thread I thought it was a python module error, but this makes me think it is not. I was able to access the 'function not triggering' diagnostic tools, but it says this when I click on it: 'Thank you for testing the Flex Consumption plan public preview, this detector will be updated soon.' |
I empathize. Are you able to run the function locally in the diagnostic tools? My other thoughts is that it could be an issue with your host.json file, or configuration somehow. However, it also sounds like the consumption plan is in public preview, which could mean that you have an altogether new issue that isn't a good match for this issue thread. |
@BillmanH I am able to run the function locally. I believe that my host.json is alright:
I am starting to worry it may just be an issue with the flex consumption plan. The odd things is what by deploying through the Azure VSCode extension, I can see all the triggers fine, and then as soon as I redeploy the resources via Bicep, they disappear. |
Can you try adding a list of functions in that script that you want to load?
|
I just want to specifically thank @BillmanH , this has been a plague on my existence the last few days until I finally saw your comment. |
Just another kudos to @BillmanH for redirecting a lost brother back to the light. If you are a newbie that created a toy app with "func init", it is essential to update the requirements.txt file before deploying with:
if you just add the names of the packages without the version numbers (as a newbie could think is the right way after inspecting the auto-generated requirements.txt, that only has "azure-functions" listed), you are in for trouble. |
My problem was with FastAPI + Function Apps. Everything worked fine locally, but when I deployed, it all looked fine (no error logs I could find) but there would be no actual functions/my API would return 404s. It's probably due to uncaught, top-level errors (i.e. at module load time). If you can't use a different service, I recommend starting with this: https://github.com/Azure-Samples/fastapi-on-azure-functions, and very slowly moving your code over into that repo, committing each time you get it working. You'll be able to find what bit of code is problematic that way. |
Thanks @BillmanH !! In my case, I did not set my environment variables in Azure Portal. |
This was absolutely the solution that worked for me! Thank you so much! |
thank you! jesus christ that had me worried. Hail satan. |
In my case, it appears there was a mismatch between the python version in Az Pipeline ubuntu-latest and what the function app instance was running in Azure. Pinning the python version in the pipeline before installing the packages with pip seems to have resolved the issue. ex.
That took me a while to figure that one out as the logs were not helpful. i.e. You could see the modules couldn't be found while the function app was starting up but when you look at the build zip file, everything was in the right spot under .python_packages/** Edit: |
Adding my experience and solution FWIW. Similar to many people I was having issues once I added external packages. But the errors are lost due to the above mentioned azure functions poor design, and the function still deploys correctly. The only logs I could see would say:
My solution - put the imports in a try/catch, do not raise the error so the function deploys correctly, but set it to a global variable ( Add a
In my personal case, the actual error that was getting swallowed by azure functions became clear from this health_check response. It was
So while ultimately my fault, azure functions made it a PITA to debug. Hope this helps someone else! |
Like everyone, I have the same error and the main error log states - "No job functions found. Try making your classes and methods public". This is very vague, so I tried all the methods listed above but was unable to resolve the issue. So, I tried @klettg function and added in my dependencies but was having the same issues. Some note-worthy points:
Can anyone please help? |
I wanted to share my experience with this issue. I encountered the same error: "No job functions found. Try making your classes and methods public." Despite trying various solutions, nothing seemed to work. Here are the steps I took to resolve this issue:
After doing all that, I got the following error:
Offending Line of Code: text += f"{node["value"]}" The issue arises because Azure function app servers use Python 3.11, where f-strings with double quotes inside double quotes are not allowed. This kind of syntax is fixed in Python 3.13. I hope this helps others facing the same problem. Why was this error not logged in the application's logs? It would have saved me countless hours of debugging. |
kudos to @BillmanH |
@AhHanie this comment is a blessing! Running locally was working for me but deploying to the cloud was not, then I tried running locally in a different machine and it failed with the f-string error, but I didn't know double quotes were not allowed. |
Sadly, no ssh in free consumption plan (Y1).... But the solution seems great |
What worked for me was to make sure that the requirements were installed in the correct folder.
When I added this to the pipeline, all the functions became visible again in the Azure portal |
All these issues.. Just adding to this thread to keep it visible. Seems like the lack of any telemetry from functions that fail to deploy is the main problem here. It also does not help that there is a delay between the time the azure portal tells you your function has been deployed to when its actually available for calling. We literally have to deploy our stuff line for line to figure out what is erroring and add comments to the code so we can see what we are actually running. Is there anyone from MS looking into this? |
Also ran into the issue, would be great to have logging for function compilation, it's not workable without it, makes troubleshooting ultra hard... already lost hours |
Thanks for opening this issue. We are working on providing visibility into errors that happen when function host starts in AppInsights soon so you will be able to find out what failed and fix the app. We are also working on shifting these errors to deployment time. |
After hours of banging my head against a wall with no logs, I just want to thank you. This actually output a log with a useful error (needed to give the function app permission to a Key Vault) Why is stderr here not logged in the |
It's impossible to fix the issue without proper log. The Azure support states that such logs are "internal". So, it's easier to debug a microcontroller than a Azure Functions. The support gives the log, but it's a hit or miss, in my case the issue is related to "requests" dependency, but I can't fix that nor I know if that is the only issue. Well, the Microsoft quality standard: poor documentation, poor software design and terrible service. Luckily, I need to use it for just couple of months: then I'll move everything to a bare-metal (cheaper, faster and easier). |
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
The text was updated successfully, but these errors were encountered: