Skip to content

"AddSignalRCore()" call in a class that implements FunctionsStartup overrides Auth Policy #8271

@satvu

Description

@satvu

Not sure how often we get a case of this (@kashimiz and I have both resolved incidents caused by this) but wanted to make sure this discussion/info is noted somewhere.

Repro

This is the repro I got last week

  • V3 Inproc dotnet app
  • Startup class that implements FunctionsStartup
  • Add the line builder.Services.AddSignalRCore(); to the Configure method of this class.

Why this breaks a function app

In this line of AddSignalRCore(), an auth policy provider is added that seems to override our own. This override causes calls to endpoints like "admin/host/status" to fail.

Official docs for using SignalR with Functions do not ask users to do this -- it seems to be that some users familiar with ASP.NET Core outside of functions assumed that the programming model they are used to would work similarly with functions.

The SignalR Extension already does the work needed to get the bindings working (see here) so the AddSignalRCore() call is not actually needed.

Potential improvements

Again, unclear on how often people have run into this since our official docs (and most of the unofficial tutorials I've seen) don't tell users to wire up their SignalR functions this way, but there has been more than one incident caused by a misunderstanding of the programming model.

We could add an analyzer, add a note to emphasize not doing this somewhere, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions