Api returning 400 BadRequest (.Net)
Rasmus
Posted on
Sep 09 2014
Howdy
I have been trying to get Raygun working in an Umbraco Website in Microsoft Azure Websites. I have configured the web.config as described in your documentation.
Installed via nuget (version 3.3.1) RaygunSettingssection with apikey both with and without mediumTrust="true" modules in system.web and system.webserver
At first I had an error in my views\web.config which was sent correctly to Raygun.
I then tried breaking the site with a bad Razor template, these errors did not appear in the dashboard.
I have now tried to attach a debugger on the site and I can see that your api is replying with a 400 Bad Request when my site is trying to send an error.
From the debug window
"Error Logging Exception to Raygun.io The remote server returned an error: (400) Bad Request."
Recap Set up correctly since the web.config error got sent to Raygun ok. But when error occurs in application, the logging fails with 400 from the Raygun api.
Jamie Penney
Posted on
Sep 09 2014
Hi Rasmus,
Thanks for the detailed error report! I've had a look at our API logs, and it looks like that API request came in with an empty body. Could you try the following for me:
- Implement the IRaygunApplication interface on your HttpApplication class (or the Umbraco equivalent)
- Create and return a new RaygunClient in the GenerateRaygunClient() method
- Attach an event handler to the SendingMessage event on that RaygunClient
- See if there is anything set on the Message property of the event args.
I can't think of a good reason why the API request would have an empty body - I've tried triggering compilation errors in a razor template on an MVC site hosted on Azure, and it all seems to work. It might be something specific to Umbraco?
Another option would be to redirect Raygun to an endpoint you control and inspect the HTTP request it sends when the error occurs - if you set the endpoint property on the raygunSettings element in your web.config, the RaygunClient will send errors to that instead. If you do go that far and the message is not empty, could you email it to me at jamie at mindscape dot co dot nz?
Thanks, Jamie
John Harrison
Posted on
Sep 12 2014
I had the same problem.
I downgraded from 3.3.1 to 3.3.0, and everything started working.
Jamie Penney
Posted on
Sep 12 2014
That is worrying. We've got a few changes in there that might have caused a regression like this, but it seems to be data dependant. Any chance you could capture a failing request for us and send the contents to me (jamie at mindscape.co.nz)? There was a change to the JSON serialiser that might have caused it, otherwise there were a few other changes that could contribute. The annoying thing is that the content of the request is not being logged on our end - which indicates to me that it is invalid in some way, but doesn't exactly give me any useful information on how it might be wrong. If I could get a copy of the request on your end it would help immensely.
Jason Fauchelle
Raygun
Posted on
Sep 15 2014
Hi Rasmus and John,
We believe we have tracked down and resolved the issue causing the 400 Bad Request error. This fix is available right now in the latest version on NuGet and GitHub (v 3.3.2). Let us know if this resolves the issue for you.
NuGet: https://www.nuget.org/packages/Mindscape.Raygun4Net/
GitHub: https://github.com/MindscapeHQ/raygun4net
-Jason Fauchelle