You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever PCS receives an OPTIONS request (e.g. OPTIONS https://maestro.dot.net/index.html, it can be easily reproduced locally too), the SPA middleware blows up with an exception:
{
"severityLevel": "Error",
"outerId": "0",
"message": "The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.\nYour application is running in Production mode, so make sure it has been published, or that you have built your SPA manually. Alternatively you may wish to switch to the Development environment.\n",
"type": "System.InvalidOperationException",
"id": "51846141",
"parsedStack": [
{
"assembly": "Microsoft.AspNetCore.SpaServices.Extensions, Version=8.0.8.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"method": "Microsoft.AspNetCore.SpaServices.SpaDefaultPageMiddleware+<>c__DisplayClass0_0.<Attach>b__1",
"level": 0
},
{
"assembly": "Microsoft.AspNetCore.StaticFiles, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"method": "Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke",
"level": 1
},
{
"assembly": "Microsoft.AspNetCore.SpaServices.Extensions, Version=8.0.8.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"method": "Microsoft.AspNetCore.SpaServices.SpaDefaultPageMiddleware+<>c__DisplayClass0_0.<Attach>b__0",
"level": 2
},
{
"assembly": "Microsoft.AspNetCore.Diagnostics, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"method": "Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware+<Invoke>d__3.MoveNext",
"level": 3
},
{
"assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
"method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
"level": 4
},
{
"assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
"method": "System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess",
"level": 5
},
{
"assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
"method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
"level": 6
},
{
"assembly": "Microsoft.AspNetCore.Authorization.Policy, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"method": "Microsoft.AspNetCore.Authorization.AuthorizationMiddleware+<Invoke>d__11.MoveNext",
"level": 7
},
{
"assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
"method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
"level": 8
},
{
"assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
"method": "System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess",
"level": 9
},
{
"assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
"method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
"level": 10
},
{
"assembly": "Microsoft.AspNetCore.Authentication, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"method": "Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+<Invoke>d__6.MoveNext",
"level": 11
},
{
"assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
"method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
"level": 12
},
{
"assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
"method": "System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess",
"level": 13
},
{
"assembly": "System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
"method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
"level": 14
},
{
"assembly": "Microsoft.AspNetCore.Server.Kestrel.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"method": "Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__238`1.MoveNext",
"level": 15
}
]
}
These requests are sent by most browsers to figure out how to download the web pages the best so exceptions happen each time someone visits BarViz.
These exceptions are then polluting application insights and it's not possible for us to configure alerting properly.
The request for index.html OPTIONS hits the SPA middleware
The SPA middleware checks and sees the index.html page and delegates the request to the local static file middleware (UseStaticFiles())
This file middleware does not see the index.html page (I think?) and returns 404
The SPA middleware does not expect this and blows up
Goal
I think the right fix would be to figure out why the index.html is not visible for the local static file middleware and why it returns 404. Though if you remove the SPA middleware, the local static files middleware also returns 404. Not sure if this is a bug still.
Alternatively, we can also throw out the SPA middleware and write a custom - its function is to redirect all requests to index.html so that the SPA page loads so this should be fairly simple (a single Use() might just do it).
But be careful, I quickly tried to fix this here: #4287 and the service stopped doing 500s but the Azure Container App healthchecks started failing (I guess they use OPTIONS?). So this needs to be tested in INT before merging.
The text was updated successfully, but these errors were encountered:
Context
Whenever PCS receives an OPTIONS request (e.g.
OPTIONS https://maestro.dot.net/index.html
, it can be easily reproduced locally too), the SPA middleware blows up with an exception:These requests are sent by most browsers to figure out how to download the web pages the best so exceptions happen each time someone visits BarViz.
These exceptions are then polluting application insights and it's not possible for us to configure alerting properly.
The problem is probably in the middleware (dotnet/aspnetcore#5223 (comment)) and goes like this:
index.html
OPTIONS hits the SPA middlewareindex.html
page and delegates the request to the local static file middleware (UseStaticFiles()
)index.html
page (I think?) and returns 404Goal
I think the right fix would be to figure out why the
index.html
is not visible for the local static file middleware and why it returns 404. Though if you remove the SPA middleware, the local static files middleware also returns 404. Not sure if this is a bug still.Alternatively, we can also throw out the SPA middleware and write a custom - its function is to redirect all requests to
index.html
so that the SPA page loads so this should be fairly simple (a singleUse()
might just do it).But be careful, I quickly tried to fix this here: #4287 and the service stopped doing 500s but the Azure Container App healthchecks started failing (I guess they use
OPTIONS
?). So this needs to be tested in INT before merging.The text was updated successfully, but these errors were encountered: