I have developed an azure function app. It is in Python and works perfectly fine. I first developed this in a virtual environment using pyenv on my laptop.
Now, I switched to another laptop, downloaded the function app and set a new virtual environment for this laptop. The function starts fine and the virtual environment works. The packages are installed as far as I can see.
However, when starting the function, I get the 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.)’.
I have seen others with similar issues. However, these issues were mostly in the host.json and the local.settings.json.I have not yet been able to find a solution to it, or an error in both of these files. Also, my function_app.py does not throw any errors (possibly because it is not seen…)
The first few lines of my function_app.py, where i added the @app.function_name line as per previous posts:
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)
@app.function_name("func")
@app.route(route="http_example", auth_level=func.AuthLevel.ANONYMOUS)
def http_trigger(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
the host.json:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.15.0, 4.0.0)"
}
}
the local.settings.json:
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsFeatureFlags": "EnableWorkerIndexing",
"AzureWebJobsStorage": "UseDevelopmentStorage=true"
}
}
It is good to know that this is another laptop, logged in with an account from another tenant. I am not sure if this may cause an issue.
Thank you in advance.