dotnet / systemweb-adapters

MIT License
332 stars 58 forks source link

gRPC clients cannot read messages when using services.AddSystem.WebAdapters() #461

Closed pockets3407 closed 3 months ago

pockets3407 commented 7 months ago

Summary

If it is possible, I would like to move middleware inside HttpContextStartupFilter into UseSystemWebAdapters(this IApplicationBuilder app).

Motivation and goals

Risks / unknowns

I'm not sure if the middleware order will be affected by this move.

I don't think developers will notice this change, app.UseSystemWebAdapters() should always be configured during startup. Perhaps, there is something I am missing, but documentation could also be updated to include this.

Examples

            app.UseWhen(
                context => context.Request.ContentType != "application/grpc",
                builder =>
                {
                    builder.UseSystemWebAdapters();
                }
            );
twsouthwick commented 6 months ago

Which version are you using?

twsouthwick commented 6 months ago

I ask, because the only thing done now in the pipeline outside of the app.UseSystemWebAdapters() call is update a few feature implementations (that was a change in v1.3 - in 1.2, a number of other things were done as well that caused other problems similar to this).

pockets3407 commented 6 months ago

@twsouthwick This issue occurs in both 1.3 and 1.2

twsouthwick commented 6 months ago

Can you provide a working repro then to show this setup?

pockets3407 commented 6 months ago

@twsouthwick Sure, here is the repo I have tested everything on. https://github.com/pockets3407/SystemWeb-Adapters-461

twsouthwick commented 4 months ago

Found the issue - we were not flushing the PipeWriter which gRPC uses