-
Notifications
You must be signed in to change notification settings - Fork 35
Description
π Reproduction steps
I'm using the Appwrite iOS SDK with my self-hosted Appwrite instance. When fetching documents that result in responses larger than 1024 bytes, the SDK fails with a gzip decompression error. Smaller responses work fine.
π Expected behavior
SDK should decompress valid gzip responses from self-hosted Appwrite server.
π Actual Behavior
Error
NIOHTTPDecompression.DecompressionError.inflationError(code: -3)
Steps to Reproduce
- Set up self-hosted Appwrite 1.8.0 with default configuration
- Create a collection with 3+ documents
- Fetch documents using iOS SDK:
let documents = try await databases.listDocuments( databaseId: "mydb", collectionId: "mycollection" )
- Error occurs when response > 1024 bytes (compression threshold)
- Works fine with 1-2 documents (no compression)
Workaround
Setting _APP_COMPRESSION_MIN_SIZE_BYTES=10485760 in Appwrite's .env fixes the issue by disabling compression.
Debugging with Claude
I performed extensive debugging with Claude Opus AI assistant to isolate this issue. Here are the results:
Server Response Validation
| Test | Result |
|---|---|
| curl + gunzip decompression | β Works |
| gzip -t validation | β Valid gzip |
| Python gzip module | β Works |
| Python zlib raw inflate | β Works |
| HTTP/1.1 vs HTTP/2 comparison | β Identical binary data |
| Content-Encoding: gzip header | β Present |
| X-Utopia-Compression: true header | β Confirms Appwrite compression |
| AsyncHTTPClient (SDK) decompression | β Fails |
Conclusion
The server returns perfectly valid gzip data that can be decompressed by curl, gunzip, Python, and other tools. However, AsyncHTTPClient/swift-nio-extras fails to decompress it with Z_DATA_ERROR (-3).
This may be a bug in:
- AsyncHTTPClient HTTP/2 frame handling
- swift-nio-extras NIOHTTPDecompression
- Or an edge case in how these libraries handle gzip from Appwrite
π² Appwrite version
Different version (specify in environment)
π» Operating system
Linux
π§± Your Environment
- Appwrite Server: 1.8.0 (self-hosted, Docker)
- Appwrite iOS SDK: 13.5.0
- iOS Version: 18.0 / 26.0 beta
- Xcode: 16+
- Tested on: Both Simulator and Physical Device
- Reverse Proxy: Traefik 2.11 (default Appwrite Docker setup)
- Cloudflare: DNS Only mode (no proxy)
π Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
π’ Have you read the Code of Conduct?
- I have read the Code of Conduct