azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

[BUG] Azure Functions Python Worker does not report errors during function startup

Open sapountzis opened this issue 2 years ago • 5 comments

We have encountered an issue when using version 4 of the azure-functions-python-worker package.

The problem occured when the python function crashed during startup, due to an import error, which was breaking our code.

In this case, there is no error message in the azure logs. This makes it very difficult to identify the reason for the crash and debug it.

One sign of this issue is when the "Syncing triggers..." action fails during deployment after multiple retries.

Another sign is receiving a "no functions found" warning that has nothing to do with the error.

To reproduce the bug, you can create any function that has an import error, syntax error or any other error that prevents the function from starting.

The fundamental issue seems to be that there is no direct access to the python runtime where the app lives. The only deployment option for the "consumption" plan is ZipDeploy that builds everything in a separate environment and then transfers the files to the actual azure function environment. We accidentally managed to find the actual bug in the code that was crashing the function when we decided to use a custom docker image for our azure function app after all our previous debugging attempts failed. Inside the docker container, we executed the "func start" during build time just to test if it's working and that's where we saw the import error.

We believe that the azure logging should report the function crash in the same way that running it in the console locally does. This would greatly improve the debugging experience for developers.

We hope that this issue can be addressed in a future release of the azure-functions-python-worker package.

sapountzis avatar Jan 20 '23 11:01 sapountzis