exceptionless / Exceptionless.Net

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

Unable to submit events in .NET5 on Linux #240

Closed DanielPeinhopf closed 3 years ago

DanielPeinhopf commented 3 years ago

I've created a very simple .NET5 based app trying to submit a simple log event but Exceptionless is unable to submit the event. My project file looks like:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Exceptionless" Version="4.5.0" />
    <PackageReference Include="Exceptionless.AspNetCore" Version="4.5.0" />
  </ItemGroup>
</Project>

And here is my demo code:

var client = new ExceptionlessClient(x =>
{
    x.ApiKey = apiKey;
    x.UseLogger(new SelfLogger());
});

var ev = client.CreateEvent();
ev.SetType("exception");
ev.SetMessage("Hello world");
ev.Submit();

await Task.Delay(10000);

On Windows it works fine but on Linux (RID: linux-arm64) it gives me the following errors:

Checking event: Hello world with hash: -166658853
Enqueueing event with hash: -166658853 to cache.
Submitting event: type=exception
Processing queue...
An error occurred while submitting events.
Suspending processing for: 00:05:00.

Does anyone know this problem or have an idea of how i can get more information on this?

niemyjski commented 3 years ago

You are already using the client logs, and it doesn't look like an error message is being returned: https://github.com/exceptionless/Exceptionless.Net/blob/c00d2eab7902d3e2504026f52ac762024baf39cb/src/Exceptionless/Queue/DefaultEventQueue.cs#L112

Are you able to debug this at all? If so, could you resolve the submission client and step into it by calling any of the methods?

var submissionClient = client.Configuration.Resolver.Resolve<ISubmissionClient>();

Also is there a specific linux base image you are using?

DanielPeinhopf commented 3 years ago

Thank you for your tips. I've now compiled the Exceptionless client by myself and found the following errors:

The SSL connection could not be established, see inner exception.
The remote certificate is invalid because of errors in the certificate chain: PartialChain

I'am using a Buildroot-built custom image and think i need to install some additional certificates. So this doesnt have something to do with .NET5 or Exceptionless in detail. Sorry...

niemyjski commented 3 years ago

Thanks for the follow up. Are you trying to use our hosted service or self hosted with a custom ssl cert? If it's the first one, I'd love to know what dependencies you needed to make it work as that's really odd. If it's the second one, on the Exceptionless Client config object there is a setting that allows you to ignore or configure ssl certificates and it would be worth checking this out.

DanielPeinhopf commented 3 years ago

Ok, i finally solved it. I'am using the hosted service at the moment and here is what i've done: First i've figured out that the hosted exceptionless endpoint is using a LetsEncrypt certificate. Then i went to this LetsEncrypt page which told me the LetsEncrypt Root CA which is "ISRG Root X1". This certificate is contained int the "ca-certificates"-bundle-package which is available for Buildroot so i've installed that package and now it's working. :)

niemyjski commented 3 years ago

Awesome!!! Thanks for the followup.