Azure / Azure/Azure-Functions

No HTTP Trigger Found When Deploying FastAPI Azure Function (Python v2)

Open
#2,607 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

Hello,

I’m using the Python v2 programming model in Azure Functions along with FastAPI. I’ve been successfully deploying my project until recently, when I began receiving this error during deployment:

```
No HTTP triggers found.
```

Here’s the full context:

---

### I have **not changed** any of the following:
- `host.json`
- `local.settings.json`
- VS Code config files
- Azure Portal > Function App settings (Application Settings)

The only changes I've made are inside `function_app.py` and `main.py` (where FastAPI is used).

---

### `function_app.py`

```python
import azure.functions as func
from main import app as main

app = func.AsgiFunctionApp(app=main, http_auth_level=func.AuthLevel.ANONYMOUS)

@app.function_name(name="MatchTimerTriggerFunction")
@app.schedule(schedule="0 * * * * *", arg_name="myTimer", run_on_startup=False, use_monitor=True)
async def fifteen_timetrigger(myTimer: func.TimerRequest):
if myTimer:
print("Match Timer Trigger Function")

@app.function_name(name="CountdownTriggerFunction")
@app.schedule(schedule="0 * * * * *", arg_name="myTimer", run_on_startup=False, use_monitor=True)
async def countdown_timer(myTimer: func.TimerRequest):
if myTimer:
print("Countdown Timer Trigger Function")

@app.function_name(name="ExpiredMatchesTriggerFunction")
@app.schedule(schedule="0 * * * * *", arg_name="myTimer", run_on_startup=False, use_monitor=True)
async def countdown_timer(myTimer: func.TimerRequest):
if myTimer:
print("Expired Matches Trigger Function")
```

---

### `main.py` (FastAPI Entry)

```python
import fastapi
from fastapi.middleware.cors import CORSMiddleware

app = fastapi.FastAPI(...)

app.add_middleware(CORSMiddleware, ...)

from api.v1.homepage import router as homepage
app.include_router(homepage, prefix="/api/v1/homepage", tags=["Homepage"])

@app.get("/")
async def test():
return {"message": "test"}
```

---

### Project is modular. Example FastAPI route:

```python
# api/v1/homepage/__init__.py
from fastapi import APIRouter, Depends, Query, Header
from fastapi.security import OAuth2PasswordBearer
from schemas.responses import StandardResponse

router = APIRouter()
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="auth/login")

@router.get("", response_model=StandardResponse)
async def homepage(token: str = Depends(oauth2_scheme), timezone: str = Query(...), language: str = Header("en")):
return StandardResponse(status="success", statusCode=200, data="homepage")
```

---

### Everything works locally via `func start`.

---

### Application Settings (Azure Portal) are verified:
- CosmosDB
- Blob Storage
- Application Insights
- AzureWebJobsStorage
- AzureWebJobsFeatureFlags = `EnableWorkerIndexing`

---

### Dependencies (requirements.txt) are valid
- Fresh virtual environment installs correctly
- `pip freeze` matches expected output

---

### Deployment Behavior

Sometimes deployment works and I see:

```
HTTP Trigger Urls:
http_app_func: https://fifteen.azurewebsites.net//%7B*route%7D
```

But even with a **minor change** (like a `print()` statement), I get:

```
No HTTP triggers found.
```

---

### Relevant Config Files

#### `host.json`
```json
{
"version": "2.0",
"functionTimeout": "00:05:00",
"extensions": {
"http": {
"routePrefix": ""
}
},
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
}
```

#### `local.settings.json`
```json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsFeatureFlags": "EnableWorkerIndexing",
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "python",
"fifteen_DOCUMENTDB": ""
},
"ConnectionStrings": {}
}
```

#### `function.json`
```json
{
"scriptFile": "function_app.py",
"bindings": [
{
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": ["get", "post", "delete", "options"],
"authLevel": "anonymous"
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
]
}
```
here is my file structure:

![Image](https://github.com/user-attachments/assets/ca69523f-a978-4149-8b6d-ce5850340644)

@eylulonar @frkinal

---

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with function_app.py and main.py, then compare deployment trigger discovery with the locally working `func start` behavior. Verify that deployment consistently discovers the FastAPI HTTP app and the scheduled functions, rather than reporting no HTTP triggers; no test files are mentioned in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, fastapi, python
Domain
api, backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.