Skip to content

πŸ› Bug Report: gzip decompression error on self-hosted AppwriteΒ #97

@nonisolated

Description

@nonisolated

πŸ‘Ÿ 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

  1. Set up self-hosted Appwrite 1.8.0 with default configuration
  2. Create a collection with 3+ documents
  3. Fetch documents using iOS SDK:
    let documents = try await databases.listDocuments(
        databaseId: "mydb",
        collectionId: "mycollection"
    )
  4. Error occurs when response > 1024 bytes (compression threshold)
  5. 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?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions