Couchbase Lite iOS Simulator Replication Error - 400 bad_request

Could you please help? We’ve taken the sample grocery iOS app and modified it slightly to point at our Sync Gateway instance running on EC2.

Everything worked until yesterday when I deleted the app from within the iPhone Simulator and restarted it with the intent to recreate the CBL database and pull down the documents from the server.

The app is now failing to replicate and throwing the following error everytime:

Error Domain=CBLHTTP Code=400 “400 bad_request” UserInfo=0x7ff62373d070 {NSLocalizedFailureReason=bad_request, NSLocalizedDescription=400 bad_request}

What is causing this error?

Thank you.

Can you enable Sync and SyncVerbose log tag group as below and provide logging messages?

[CBLManager enableLogging:@“Sync”];
[CBLManager enableLogging:@“SyncVerbose”];

Thanks Pasin. I’ll do that and get back to you.

Hi Pasin

Here is the output with logging enabled.

09:17:12.717| Sync: CBLReplication[to ec2-54-77-23-13.eu-west-1.compute.amazonaws.com:4984/sync_trade/]: offline, progress = 0 / 0, err: (null)
09:17:12.719| Sync: CBLReplication[from ec2-54-77-23-13.eu-west-1.compute.amazonaws.com:4984/sync_trade/]: offline, progress = 0 / 0, err: (null)
09:17:12.816| Sync: CBLReplication[to ec2-54-77-23-13.eu-west-1.compute.amazonaws.com:4984/sync_trade/]: stopped, progress = 0 / 0, err: 400 bad_request
2015-01-18 09:17:12.816 trade[18984:1658662] Error syncing
09:17:12.819| Sync: CBLReplication[from ec2-54-77-23-13.eu-west-1.compute.amazonaws.com:4984/sync_trade/]: stopped, progress = 0 / 0, err: 400 bad_request
2015-01-18 09:17:12.819 trade[18984:1658662] Error syncing

What can you infer from it?

Many thanks

Alfie

From the log, it looks like you missed the ‘http://’ in front of your sync gateway address. Can you double check that?

1 Like

Hi Pasin

You are spot on. That was exactly the problem.

Thanks very much.

Alfie