exceptionless / Exceptionless.Net

Exceptionless clients for the .NET platform
https://exceptionless.com
Other
555 stars 142 forks source link

HTTP 411 Response #198

Closed dknoodle closed 5 years ago

dknoodle commented 5 years ago

Hi, we are using Exceptionless version 4.3.2012 in a project which is deployed to both a Staging and a Production environment. The Staging environment logs errors to Exceptionless with no problems but the Production environment gets HTTP 411 response on every exception submitted to Exceptionless. In fact the Exceptionless project for Production has no logs of any kind in it.

The code in both environments is identical with the Exceptionless Key being the only difference. We have Application Insights logging some other metrics for the project which is how we found the 411 details in the dependency logs. I confirmed there have been about 30+ logs sent to Exceptionless from the Production environment but they are all being rejected with 411 response codes.

The app being monitored is .Net Core 2.0 running on Linux/Docker in a Kubernetes cluster.

Anyone have any ideas?

dknoodle commented 5 years ago

I figured out the issue, I had base64 encoded the Exceptionless key with a line break at the end by accident.

Note: I think the API should have returned a better error message showing the Key was invalid.

niemyjski commented 5 years ago

We should have been returning a 401 instead saying unauthorized. Any reason for base64 encoding your key? Any chance you can add a test for us for a similar key or send us a key that will reproduce

dknoodle commented 5 years ago

The key is stored in a secrets vault in Kubernetes which requires it to be base64 encoded for storage in the secret. I copied and pasted the key from the Exceptionless website into an online base64 encoder and I assume I accidentally pushed enter when pasting it or there was a carriage return / line feed in the textbox when I pasted it. In any case I copied the encoded version into our secrets with the line feed on the end of the key. Everywhere it displayed the key for me it looked fine but we noticed in a console log there was a line break after outputting the key and found the issue.

Here is a sample base64 string I created, I don't have the original I used anymore. RXhjZXB0aW9ubGVzc19LZXlfVGVzdAo=

niemyjski commented 5 years ago

I've fixed this issue by adding improved response messages :). Thanks for reporting this.