Skip to content
Back

Inconsistent header related error in c# sdk

  • 0
  • Self Hosted
Kent Lan
22 Jun, 2025, 05:26

I've been banging my head against an issue for days at at this point it seems like it's something to do with the sdk so I've spent several hours tonight on it. I can make calls to appwrite successfully for a while and it seems like the issue pops up when there are several calls together but even then it takes many tries to trigger it then it sticks because the client(appwrite Users) is "poisoned". This presents as "Object reference not set to an instance of an object.'" but nothing I've passed is null. I ended up tracing it back to here(screenshot #1) in HttpConnection.cs where it appears to be processing headers. Going back up the stack I find that the http client has two empty header keys(screenshot #2) and those seem to be what ends up as nulls. Has anyone seen this or have insight into where these headers come from? Once they are there they stick because this only removes default headers when they match something that is passed in.

React frontend talking to a c# backend to an updated self-hosted Appwrite server.

TL;DR
Developers are experiencing an inconsistent header-related error in the C# SDK, possibly due to a race condition when modifying headers in the GitHub link provided. The issue arises when multiple calls are made consecutively, leading to a "Object reference not set to an instance of an object." error. By tracing the problem back, it seems to stem from empty header keys in the HTTP client. To address this, check the code in HttpConnection.cs and Client.cs for any discrepancies in header handling.
Kent Lan
22 Jun, 2025, 05:42

My best guess is a race condition when the headers are being modified in that github link.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more