Error when uploading file bigger than 5GB
Bug report
Describe the bug
When uploading a file which is bigger than 5GB, on the Pro Plan with a global limit of 20GB the following error is returned:
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Supabase.Storage.Extensions.HttpClientProgress.UploadAsync(HttpClient client, Uri uri, Stream stream, Dictionary`2 headers, Progress`1 progress)
at Supabase.Storage.StorageFileApi.UploadOrUpdate(String localPath, String supabasePath, FileOptions options, EventHandler`1 onProgress)
at Supabase.Storage.StorageFileApi.Upload(String localFilePath, String supabasePath, FileOptions options, EventHandler`1 onProgress, Boolean inferContentType)
This is triggered because the response is not a json but a 413 error from Cloudflare:
<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
System information
- Version of supabase-csharp: 0.16.1
- Version of supabase-storage-csharp: 1.4.0
This is because our supabase-storage client hasn't yet implemented the TUS protocol like the JS client has (see here: https://dev.to/supabase/supabase-storage-v3-resumable-uploads-with-support-for-50gb-files-2egd). I'll need to look into what that entails. Always open to PRs if you're interested!
I'm going to see about replacing our HttpClient implementation with the following package: https://github.com/bluetianx/BirdMessenger - which should clear this issue up and add some additional functionality!