Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Useful tip for troubleshooting HTTP/API response problems; would be good to document somewhere #973

Open
RajNZ opened this issue Nov 16, 2022 · 3 comments

Comments

@RajNZ
Copy link

RajNZ commented Nov 16, 2022

The file APIResponseRequestLoggingMiddleware.cs interrupts HTTP communications to log API calls; with some exceptions based on the URL path it wraps any response received and this is important to know because if you introduce any 3rd party system from which you are receiving a response that must remain untampered with then you must add the partial path of that system to the list of exceptions.

My example is adding Bold Reports by Syncfusion - after much troubleshooting by them and I we discovered that the JSON response being sent back from the report server wasn't working properly and it is the middleware interruption that causes the problem.
After adding their API path to the exception list things started working!

@wint100
Copy link

wint100 commented Mar 21, 2023

I'm having issues with Syncfusion Datagrid as well. When editing a Todo item with their grid, the Grid hangs and the Middleware throws a StackOverflow exception and I'm struggling to pin it down. The path at the time of exception is /_blazor. I'm hoping this is a similar issue and there's a quick fix but so far I'm failing to find the cause.

@wint100
Copy link

wint100 commented Mar 21, 2023

This is where it fails for me:
image

@RajNZ
Copy link
Author

RajNZ commented Mar 22, 2023

I don't know the answer, but I suggest you add another exception to the StartsWithSegments check on the previous line. This will allow the code in the next block to execute instead...
...

if (new string[] { "/api/localization", "/api/data", "/api/externalauth" }.Any(e => request.Path.StartsWithSegments(new PathString(e.ToLower()))))
                            await _next.Invoke(httpContext);

Then add the same exception again to the StartsWithSegments check here - maybe calling _next.Invoke() here is better than simply _next() done earlier?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants