Altinn / altinn-file-scan

Microservice for handling file scan
MIT License
0 stars 0 forks source link

Invalid configuration of the ExceptionHandling #99

Open SandGrainOne opened 9 months ago

SandGrainOne commented 9 months ago

Description of the bug

The following message was registered in application insights in production:

The exception handler configured on ExceptionHandlerOptions produced a 404 status response. This InvalidOperationException containing the original exception was thrown since this is often due to a misconfigured ExceptionHandlingPath. If the exception handler is expected to return 404 status responses then set AllowStatusCode404Response to true.

Looking into this we see that the ExceptionHandlier is pointed to a non existent endpoint.

Program.cs L277

app.UseExceptionHandler("/filescan/api/v1/error");

We need to either ensure that the endpoint exists or find a solution that doesn't require an endpoint. Is there a default handler that can be used instead?

Steps To Reproduce

Force an exception that isn't handled by the logic, but bobble up to the built in middleware.

Additional Information

A simple fix would be to add a Controller to support the missing endpoint. We've done this in other applications.