Skip to content

Make InvalidHostServicesException a fatal error #2045

Description

Make InvalidHostServicesException a fatal error on startupin v4. In v3 we only log an error.

Motivation

In Functions v3 DependencyValidator on startup analyzes registered services here and logs an error if things aren't as expected (i.e. missing expected services or unexpected services). Ideally that would have been a fatal error preventing the host from starting up but we couldn't introduce that breaking change in v3. As a compromise, we instead updated the CLI to fail in this case (code here). However the intent all along was to prevent host startup in these situations.

Impact

Over the last 7 days, there are 569 distinct apps that have missing or invalid services.

All("FunctionsLogs")
| where PreciseTimeStamp > ago(7d)
| where Level < 3
| where Source == "Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.DependencyValidator"
| where Summary startswith "Invalid host services detected."
| project AppName, Summary, Details
| summarize HasInvalid=countif(Details contains "[Invalid]") > 0, HasMissing=countif(Details contains "[Missing]") > 0 by AppName
| order by AppName asc

This query shows the types of errors we're seeing currently:

All("FunctionsLogs")
| where PreciseTimeStamp > ago(7d)
| where Level < 3
| where Source == "Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.DependencyValidator"
| where Summary startswith "Invalid host services detected."
| project AppName, Details
| distinct Details

Compat-mode support

Because the intent is for this to be a hard error and prevent any hosts from running with invalid service configurations, we won't provide any way to disable this check.

Detection

Yes, we have existing logs showing details on invalid/missing services (see query above).

Support

Documentation

I don't believe we have any existing documentation on these service restrictions. We could add some.

Components impacted

Affects only the Host. We will be able to remove the special handling in the CLI however since it'll now be fatal by default.

Performance

None. This is already an existing check.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions