Product: Couchbase Sync Gateway
Component: mobile
Issue Link: CBG-4620
Affects Version(s): 3.2.4
Fix Version(s): 3.2.5Summary
- In pre-3.2.5 Sync Gateway releases, it was found that documents synced from mobile apps were failing to sync on the second and subsequent updates when _attachments keyword was present part of the data.
- The first revision with an attachment typically succeeds, but later revisions are rejected because the server detects inconsistencies in attachment metadata (e.g., digest, length, or revision) on the server side.
- This is not expected behavior as the product should be able to handle such a scenario. Hence, it was fixed through CBG-4620 (in Sync Gateway 3.2.5 release).
Symptoms
- Sync Gateway logs for affected documents consistently show HTTP 400 Invalid _attachment errors related to attachments after the first revision has replicated.
- Replication appears partially stalled: non-attachment documents may continue to sync, while attachment documents repeatedly fail upon update.
Triggers
- String _attachments appears in the document’s Key or Value.
Verification
In the Sync Gateway logs:
- Search logs for affected document IDs and revision IDs around the failure window.
- Identify HTTP 400 Invalid _attachment error log messages for impacted document tied to attachment verification paths during revision handling. For example:
2025-04-23T18:16:06.311Z [ERR] c:[1as3cfde] db:testdb col:_default Error during downloadOrVerifyAttachments for doc testdoc1/2-4ah20130a58f4cc0447fd84864fb3d4625bbf9ac: 400 Invalid _attachments -- db.(*blipHandler).processRev() at blip_handler.go:1208- Validate that the error consistently occurs on second or later revisions of the same document.
Further Data check:
- String _attachments appears in the document’s Key or Value.
Workarounds
- Do not use the _attachments keyword string in document data.
- If this is not feasible, upgrading to Sync Gateway 3.2.5 or higher version can help mitigate.
Best Practice
- Do not use internal Sync Gateway Data Modelling keywords in your data or to drive your use case.
Comments
0 comments
Article is closed for comments.