Azure / Azure/azure-functions-python-worker

Python v2 worker should surface trigger-binding rejections as explicit ERROR logs (and avoid full-app silent drop)

Đang mở
#1,866 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
needs-attention :wave:
Ngôn ngữ chính
Python
Star
357
Fork
116
Merge trung bình
32 phút
Pull request đã merge (30 ngày)
1

Mô tả

## Summary

We hit a catastrophic silent failure mode in Python v2 function indexing: a single trigger-binding parameter mismatch (`_req` instead of `req` on `@app.route`) caused the worker to effectively drop registration for the whole app (all routes 404), with no actionable ERROR log pointing to the offending function.

## Minimal repro shape

```python
import azure.functions as func

app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)

@app.function_name(name="health")
@app.route(route="health", methods=[func.HttpMethod.GET])
async def health(_req: func.HttpRequest) -> func.HttpResponse:
return func.HttpResponse("ok")
```

With `_req` (or other non-binding name), production indexing rejects registration. Local unit tests using `app.get_functions()` can still appear green, which makes this hard to catch pre-deploy.

## Requested improvements

1. **Log binding rejections at ERROR level with function-level detail.**
Example expected message:

`ERROR: Function 'health' rejected: @app.route expects first parameter 'req', got '_req'. Function not registered.`

2. **Avoid all-or-nothing registration failure.**
Prefer registering valid functions and skipping only invalid ones (with explicit logs), instead of ending in an apparent "0 functions" state for the full app.

3. **Validate binding-name mismatches earlier (decoration-time / `app.get_functions()` path).**
Today this mismatch can slip through local tests and fail only in deployed worker indexing.

## Why this matters

This is a high-severity operator experience issue: a one-character source bug can lead to full app outage with no direct diagnostic surface to localize root cause quickly.

## References

- Internal incident + remediation ticket: TED-1910
- Fix PR in our repo (one-character change): https://github.com/tedmalone/Tsunami/pull/680
- Follow-up runbook/audit docs documenting the failure mode: https://github.com/tedmalone/Tsunami/pull/681

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start with the Python v2 indexing and app.get_functions() paths described in the issue, using the provided @app.route example to reproduce the binding-name mismatch. Done means invalid functions produce explicit function-level ERROR logs, valid functions remain registered, and the mismatch is detected before deployment.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
azure, python
Lĩnh vực
api, backend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.