SaturnFramework / Saturn

Opinionated, web development framework for F# which implements the server-side, functional MVC pattern
https://saturnframework.org
MIT License
715 stars 109 forks source link

StartUp Exception with saturn 0.13 in `add_channel` #239

Closed vilinski closed 4 years ago

vilinski commented 4 years ago

After upgrade to latest saturn the application with channels won't start.

let app = application {
    url ("http://0.0.0.0:" + string ServerSettings.SERVER_PORT + "/")
    ...
    add_channel "/load-test/channel" Channel.channel
    // commenting out above line fixes the exception in startup
}
Application startup exception: System.InvalidOperationException: No public 'Invoke' or 'InvokeAsync' method found for middleware of type 'Saturn.Channels+SocketMiddleware'.
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_0.<UseMiddleware>b__0(RequestDelegate next)
   at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build()
   at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
crit: Microsoft.AspNetCore.Hosting.WebHost[6]
      Application startup exception
System.InvalidOperationException: No public 'Invoke' or 'InvokeAsync' method found for middleware of type 'Saturn.Channels+SocketMiddleware'.
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_0.<UseMiddleware>b__0(RequestDelegate next)
   at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build()
   at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
Unhandled exception. System.InvalidOperationException: No public 'Invoke' or 'InvokeAsync' method found for middleware of type 'Saturn.Channels+SocketMiddleware'.
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_0.<UseMiddleware>b__0(RequestDelegate next)
   at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build()
   at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at Saturn.Application.run(IWebHostBuilder app)
   at <StartupCode$Server>.$Server.main@() in /.../src/Server/Server.fs:line 86
Krzysztof-Cieslak commented 4 years ago

Well, that explains why the class was public. Let me fix that

Krzysztof-Cieslak commented 4 years ago

Should be fixed in 0.13.1