Azure / Azure/Azure-Functions

Azure Functions shows 1 function found but 0 loaded when deployed

Open
#2,440 4 comments 1 reaction 1 assignee Claimed by @bhagyshricompany View on GitHub
Needs: Author feedback
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

Hello there,

I am getting the following error when I try to execute the function app in the portal.

Local time Type Details
11:17:56.524 Trace Severity level: Information, Message: Loading functions metadata
11:17:56.524 Trace Severity level: Information, Message: Reading functions metadata (Custom)
11:17:56.525 Trace Severity level: Information, Message: 1 functions found (Custom)
11:17:56.525 Trace Severity level: Information, Message: 0 functions loaded
11:17:56.546 Trace Severity level: Information, Message: Loading functions metadata
11:17:56.547 Trace Severity level: Information, Message: 0 functions loaded

My project structure is:
host.json
requirements.txt
func_app.py
ingestor
- timer_ingestor.py

func_app.py contains:
```
from ingestor.timer_ingestor import bp as tm_bp
import azure.functions as func

app = func.FunctionApp()

app.register_functions(tm_bp)
```
ingestor/timer_ingestor.py contains:
```
import azure.functions as func

bp = func.Blueprint()

@bp.timer_trigger(arg_name="req", schedule="0 0 12 * * *", run_on_startup=True, use_monitor=False)
async def ingest_data_from_cms(req: func.TimerRequest) -> None:
logging.info(f'Timer ingestion started')

db = get_client()
container = db.get_container_client('ingestionruns')

query = "SELECT TOP 1 * FROM c ORDER BY c._ts DESC"

last_run_details = container.query_items(
query=query, enable_cross_partition_query=True)
...............more logic.................
```
requirements.txt:
```
azure-functions==1.17.0
azure-cosmos==4.5.1
azure-storage-blob==12.19.0
azure-identity==1.15.0
azure-keyvault-secrets==4.7.0
numpy==1.26.2
openai==1.3.8
requests==2.31.0
nltk==3.8.1
pandas==2.1.4
azure.search.documents==11.4.0
```
Function app config:
`Host Status: {
"id": "",
"state": "Running",
"version": "4.28.4.4",
"versionDetails": "4.28.4+0c3b64d19c54864d1b021f5e1372d82df5befc1f",
"platformVersion": "101.0.7.608",
"instanceId": "",
"computerName": "",
"processUptime": 69567773,
"functionAppContentEditingState": "Unknown",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "4.12.0"
}
}`
host.json contains:
```
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
},
"functionTimeout": "-1"
}
```

The Function app stack setting is:
Stack: Python
Python Version: Python 3.10

Few Application settings:
```
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~4",
"slotSetting": false
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "python",
"slotSetting": false
},
{
"name": "PYTHON_ISOLATE_WORKER_DEPENDENCIES",
"value": "1",
"slotSetting": false
},
{
"name": "AzureWebJobsFeatureFlags",
"value": "EnableWorkerIndexing",
"slotSetting": false
}
```
When the function executed from local, the following are the terminal logs:
Starting JobHost
[2024-01-25T06:13:28.143Z] Starting Host (HostId=hmecl004839-555791399, InstanceId=2deef8c9-c2db-4e93-a5e2-bd087dde74af, Version=4.27.5.21554, ProcessId=27684, AppDomainId=1, InDebugMode=False, InDiagnosticMode=False, FunctionsExtensionVersion=(null))
[2024-01-25T06:13:28.150Z] Loading functions metadata
[2024-01-25T06:13:28.151Z] Worker indexing is enabled
[2024-01-25T06:13:28.151Z] Fetching metadata for workerRuntime: python
[2024-01-25T06:13:28.152Z] Reading functions metadata (Worker)
[2024-01-25T06:13:28.166Z] Reading functions metadata (Custom)
[2024-01-25T06:13:28.179Z] 1 functions found (Custom)
[2024-01-25T06:13:28.186Z] 1 functions loaded
[2024-01-25T06:13:28.188Z] FUNCTIONS_WORKER_RUNTIME value: 'python'
[2024-01-25T06:13:28.191Z] Adding Function descriptor provider for language python.
[2024-01-25T06:13:28.194Z] Creating function descriptors.
[2024-01-25T06:13:28.286Z] Function descriptors created.
[2024-01-25T06:13:28.295Z] Placeholder mode is enabled: False
[2024-01-25T06:13:28.297Z] Found initialized language worker channel for runtime: python workerId:54084d83-e3ce-4e03-99f7-69a3bdcc7160
[2024-01-25T06:13:28.299Z] Setting up FunctionInvocationBuffer for function: 'ingest_data_from_cms' with functionId: '5481280d-6255-59eb-a3e2-311ded01728d'
[2024-01-25T06:13:28.302Z] Sending FunctionLoadRequest for function: 'ingest_data_from_cms' with functionId: '5481280d-6255-59eb-a3e2-311ded01728d'
[2024-01-25T06:13:28.306Z] Generating 1 job function(s)
[2024-01-25T06:13:28.308Z] [channel] received 54084d83-e3ce-4e03-99f7-69a3bdcc7160: RpcLog
[2024-01-25T06:13:28.308Z] Worker process started and initialized.
[2024-01-25T06:13:28.310Z] Received WorkerLoadRequest, request ID b595aba1-2820-49c6-b270-ebc93289de6a, function_id: 5481280d-6255-59eb-a3e2-311ded01728d,function_name: ingest_data_from_cms,
[2024-01-25T06:13:28.310Z] [channel] received 54084d83-e3ce-4e03-99f7-69a3bdcc7160: RpcLog
[2024-01-25T06:13:28.312Z] [channel] received 54084d83-e3ce-4e03-99f7-69a3bdcc7160: FunctionLoadResponse
[2024-01-25T06:13:28.312Z] Successfully processed FunctionLoadRequest, request ID: b595aba1-2820-49c6-b270-ebc93289de6a, function ID: 5481280d-6255-59eb-a3e2-311ded01728d,function Name: ingest_data_from_cms,programming model: V1
[2024-01-25T06:13:28.314Z] Received FunctionLoadResponse for function: 'ingest_data_from_cms' with functionId: '5481280d-6255-59eb-a3e2-311ded01728d'.
[2024-01-25T06:13:28.392Z] Found the following functions:
[2024-01-25T06:13:28.394Z] Host.Functions.ingest_data_from_cms
[2024-01-25T06:13:28.394Z]
[2024-01-25T06:13:28.412Z] HttpOptions
[2024-01-25T06:13:28.412Z] {
[2024-01-25T06:13:28.414Z] "DynamicThrottlesEnabled": false,
[2024-01-25T06:13:28.414Z] Initializing function HTTP routes
[2024-01-25T06:13:28.414Z] "EnableChunkedRequestBinding": false,
[2024-01-25T06:13:28.415Z] No HTTP routes mapped
[2024-01-25T06:13:28.415Z] "MaxConcurrentRequests": -1,
[2024-01-25T06:13:28.416Z]
[2024-01-25T06:13:28.417Z] "MaxOutstandingRequests": -1,
[2024-01-25T06:13:28.418Z] "RoutePrefix": "api"
[2024-01-25T06:13:28.418Z] }
[2024-01-25T06:13:28.427Z] Host initialized (271ms)
[2024-01-25T06:13:28.429Z] Host state changed from Default to Initialized.

Functions:

ingest_data_from_cms: timerTrigger

....
How can we solve this issue?
I have referred the following link to rectify it "https://github.com/Azure/azure-functions-host/issues/9720" But still it didn't help.
but function app runs fine locally

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.