Hi All, I hope I’m in the right spot here, I’m ha...
# general
Hi All, I hope I’m in the right spot here, I’m having a hard time getting my azure function to work correctly and was hoping I might find some help here. I’m currently trying to create an azure function using pulumi/azure-native. The function code is written in python, (pulumi code is in TS). I’m trying to create a blob for the function web app to run from, The blob gets created but when the function is executed, I’m getting “module not found” errors for the dependancies I have defined in the
The dir I’m using as the source for the blob follows the folder structure defined here. (https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=asgi%2Cazurecli-linux%2Capplication-level#folder-structure) What am I missing? How do I correctly create this blob so that the dependancies defined in requirements.txt get installed? Thanks in advance for any time you can take. Any ideas are appreciated.
Here is code i'm using to create the webapp and blob
Also, It's completely possible that this is not a pulumi issue, I'm just wanting to rule as much out as I can.
Hey there! Some cursory googling sounds like this is an Azure issue, but I'm still happy to try helping! Have you checked the potential causes listed here? https://docs.microsoft.com/en-us/azure/azure-functions/recover-python-functions?tabs=vscode
Hey, I'm pretty sure this was something I looked at a while ago, but it's possible that I missed something important. I'll go through it again to see if anything helps. Thanks!
Hi @icy-boots-7501 Did you manage to resolve this, by any chance? I am currently facing the same issue
Hey @rough-alligator-31256. I had a few workarounds that worked temporarily, but ultimately, I was unable to deploy using this strategy. One thing that worked temporarily was to spin up all of the infrastructure (web-app, resource group, service plan etc..) using pulumi, but leave the blob and blob container out. Once resources are deployed, running
func azure functionapp publish $WEB_APP_NAME_HERE
from the root of the python project would correctly publish and install all dependancies to the web-app deployed using pulumi. Was even able to get this working in the github pipeline. This would have been a perfectly viable (if not a bit hacky) solution had we not had the issue of networking integrations in azure, which made the process a lot more difficult, and ultimately, resulted in the decision to refactor the function to C#, a language that seems to have much better support in the azure space. Perhaps the above solution will work for you? I doubt I will be doing much more investigating into this issue from this point, but I would love to know if anyone else had this issue, or how it was solved. It's simply not viable to keep trying to make it work in my case. Hope this was at least a little helpful. Good luck!
Thanks @icy-boots-7501 - that is helpful! 🙌 It’s a shame there isn’t enough information available on this. I even looked around in Github to see if someone had committed a workaround. At the moment, I have deployed (just like you have) most resources through Pulumi except the function code itself - which I have automated publishing through a Azure DevOps pipeline. I consider this a “Tech debt” for our team (having to maintain two separate deployment strategies for a single FunctionApp), so I will be on the watch out until a better approach comes along. If I do, I will post my findings here.