P2P Replication fail with attachment

I am developing a p2p mobile app with couchbase lite android (1.2.0) and couchbase lite listener(1.2.0).
For documents without attachment, everything is fine. But when I try to replicate documents with attachments, it always fail.
Here is the log output.
W/Database: Failed to get attachments for {photo #1-409dc8ea54fded397aa4d54ee03a198e}
failed to write {photo #2-04b6c43a88d3a7fb6f285c196a0e6e2b}: status=491
com.couchbase.lite.replicator.PullerInternal@493bd1e: Progress: set error = org.apache.http.client.HttpResponseException

By checking CBL’s source code, I know 491 means bad attachment, but the first revision of document always has no attachment?(If I made a mistake?)

It seems that CBL try to access old revision’s attachment, but when setting attachment, the first revision always has no attachment.
When I update Couchbase Lite to latest version (1.3.1), things get worse. Any document can’t be replicated.

Change tracker got error 404
Progress: set error = com.couchbase.lite.replicator.RemoteRequestResponseException: Not found

I am very appreciate if someone could help me?

Hi @Alex_Lai,

Thank you for reporting the issue.

P2P attachment issue is currently tracked by following the ticket. Replicator sends Multi-part document, but lister module only can handle the attachment which is embedded in the JSON body. We need to implement multipart document request handler. Please give us some time to solve this.
https://github.com/couchbase/couchbase-lite-android/issues/1037

v1.3.0 and v1.3.1 has HTTP Accept header handling issue. It is already fixed in master branch. Fix should be in next release.

Thank you!