Azure / Azure/azure-functions-host

Function App returns 202 when incorrect function name configured as Event Grid webhook - should return error code instead

Open
#8,802 8 comments 0 reactions 0 assignees View on GitHub
Needs: Attention :wave:
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

### Setup
Blob Storage trigger using Source=EventGrid (as per https://learn.microsoft.com/en-us/azure/azure-functions/functions-event-grid-blob-trigger)

This setup requires an Event Grid Subscription using an Endpoint Type = Webhook, and the URL must be in the following format: _https://.azurewebsites.net/runtime/webhooks/blobs?functionName=&code=_ is wrong, i.e. there is no function with that name, the Function App returns **202** to Event Grid, which causes Event Grid to consider the event delivered. However, since there is no function with that name, the Function App logs a DEBUG-level log and drops the event.

### Consequences
We have irrecoverable and undetected lost events. Event Grid does not retry, and worse, does not apply any dead-lettering policies to the event.

We are also not able to see this error in the logs using the default configuration.

Via a Microsoft Support ticket (#2206230050002214) we have been told to set the logging level to DEBUG so that we can pick the "error" message from the Function App, but even though that would help us with spotting the issue as soon as possible, it still does not address the underlying issue and its consequences. Critically, we lose the ability to retry any lost events.

#### Investigative information

- Timestamp: September 29th, 2022, 18:00 (cannot see exact timestamp via the Event Grid metrics)
- Function App version: ~4
- Function App name: nemsdevwebappd0anonfn
- Function name(s) (as appropriate): N/A (any name that does not map to an existing function)
- Invocation ID: 9fb4acad-a569-4ecb-b76c-30685e6c22a7
- Region: UK South

#### Repro steps

1. Create an Event Grid Subscription using a Webhook.
2. Use the following format for the Webhook URL, making sure the Function App exists but not the function: https://.azurewebsites.net/runtime/webhooks/blobs?functionName=&code=

Contributor guide

Open the contributing guide

Research direction

No source file, test, or code entry point is named. Start by reproducing the Event Grid webhook request with a nonexistent function name and inspect the host's webhook handling and logging; done means the request returns an error, logs at ERROR level, and allows Event Grid retry and dead-letter behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
api, backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.