Reputation: 145
I am using PouchDB 6.1.1 on the client-side and IBM Cloudant on the server-side. It saves to PouchDB with no issue. When I replicate using myPouch.replicate.to(..), I get 201 the status but the response has forbidden error with message/reason "The `source' property must exist and be either a string or an object." and status 500. What could be the reasons behind getting this error?
This is the doc I put to PouchDB successfully:
{
_id: "Test2017-01-11T13:47:48-05:00",
completed: false,
created_by: "Joes Moes",
created_on: "2017-01-11T13:47:48-05:00",
durationInSeconds: 1898,
edited: false,
guestVisit: false,
manualVisit: false
}
This is the response object after replicating to the Cloudant.
{
doc_write_failures: 1,
docs_read: 1,
docs_written: 0,
end_time: Wed Jan 11 2017 13:54:38 GMT-0500 (EST),
errors: [{
error: "forbidden",
id: "Test2017-01-11T13:47:48-05:00",
message: "The `source' property must exist and be either a string or an object.",
name: "forbidden",
ok: true,
reason: "The `source' property must exist and be either a string or an object."
}],
rev: "1-fdebae00ecfe324c91e85a88fd823442",
status: 500,
last_seq: 25,
ok: true,
start_time: Wed Jan 11 2017 13:54:37 GMT-0500 (EST),
status: "complete"
}
Thank you in advance!
Upvotes: 1
Views: 352
Reputation: 145
Thank you all for the answers! I found the issue on the database.
On the client-side I was using the code below to replicate to cloudant:
myPouchDB.put(doc);
myPouchDB.replicate.to(myCouchDB);
The problem was in the database itself. Somehow a replication design document (_design/_replicator) was added to that database which was causing an issue. After deleting that document, the replication from the PouchDB to Cloudant worked.
Upvotes: 1
Reputation: 883
In my JSON documents to CouchDb the properties are quoted. I notice they are not in your document. Perhaps you could try this:
{
"_id": "Test2017-01-11T13:47:48-05:00",
"completed": false,
"created_by": "Joes Moes",
"created_on": "2017-01-11T13:47:48-05:00",
"durationInSeconds": 1898,
"edited": false,
"guestVisit": false,
"manualVisit": false
}
instead?
Upvotes: 0