Note that there are some explanatory texts on larger screens.

plurals
  1. POCloudant "case_clause" error with pouchdb when replicating
    primarykey
    data
    text
    <p>I am working with Pouchdb and Cloudant, and when my web app starts up it does a replication from Cloudant down to my pouchdb in the browser. I have an idea of how pouchdb works internally, and this is how I believe the process works (high level):</p> <ol> <li>Replication starts</li> <li>Gets a checkpoint doc from cloudant db (contains latest sequence number retrived from server, if not exists, assumes sequence # is 0, which is my case)</li> <li>Grabs the changes from the changes freed starting at that sequence number (it grabs up to 25 changes)</li> <li>Writes(or updates) the checkpoint doc back to cloudant server with the new sequence number (this way if a network error occurs, it can continue where it left off or for the next replication)</li> <li>Repeats until no changes left</li> <li>Replication complete</li> </ol> <p>The problem is at step 4, that when pouch tries to write that doc to the cloudant server (for the first time), the server returns a 'case_clause' error. I am thinking the issue might be an invalid id sent to cloudant (cloudant doesn't accept ids of this format), because the id of the doc written to the server is <code>_local/799c37dfaefb3774a04f55c7f8cee947</code> (or other random numbers and characters at the end). I don't know if that is a valid doc id or not (for cloudant that is, because this is accurate for pouchdb), so I guess I am asking, is that the issue (unacceptable id for cloudant), or is there some other issue based on the error the cloudant server returns.</p> <p>Here is the doc being written:<br/> </p> <pre>{ _id: "_local/799c37dfaefb3774a04f55c7f8cee947", last_seq: "63" } </pre> <p>Here is the full error output from Chrome debugger:</p> <pre>{ error: "case_clause" reason: "{{case_clause,{ok,{error,[{{doc,>, {338, [>]}, {[{>,>}]}, [],false,[]}, {error,internal_server_error}}]}}}, [{fabric,update_doc,3},{chttpd_db,'-update_doc/6-fun-0-',3}]}" stack: Array[4] 0: "chttpd_db:update_doc/6" 1: "chttpd:handle_request/1" 2: "mochiweb_http:headers/5" 3: "proc_lib:init_p_do_apply/3" length: 4 __proto__: Array[0] status: 500 }</pre> <p>Note: When I go into cloudant's Futon and manually enter the url for the checkpoint doc using its id, it does not exist.<br/> <br/> Thanks<br/> <br/> EDIT:</p> <p>Header Info from the above request using Chrome debugger:</p> <pre> Request URL:http://lessontrek.toddbluhm.c9.io/db/ilintindingreseseldropec/_local%2F799c37dfaefb3774a04f55c7f8cee947 Request Method:PUT Status Code:500 Internal Server Error Request Headersview parsed PUT /db/ilintindingreseseldropec/_local%2F799c37dfaefb3774a04f55c7f8cee947 HTTP/1.1 Host: lessontrek.toddbluhm.c9.io Connection: keep-alive Content-Length: 111 Accept: application/json Origin: http://lessontrek.toddbluhm.c9.io User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36 Content-Type: application/json Referer: http://lessontrek.toddbluhm.c9.io/app Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Cookie: connect.sid=s%3A8MVBFmbizTX4VNOqZNtIuxQI.TZ9yKRqNv0ePbTB%2FmSpJsncYszJ8qBSD5EWHzxQYIbg; AuthSession=(removed for security purposes, but valid); db_name=ilintindingreseseldropec; __utma=200306492.386329876.1368934655.1375164160.1375252679.55; __utmc=200306492; __utmz=200306492.1372711539.22.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); c9.live.proxy=(removed for security purposes, but valid) Request Payloadview parsed {"_id":"_local/799c37dfaefb3774a04f55c7f8cee947","last_seq":"63","_rev":"338-7db9750558e43e2076a3aa720a6de47b"} Response Headersview parsed HTTP/1.1 500 Internal Server Error x-powered-by: Express vary: Accept-Encoding x-couch-request-id: 7d2ca9fc server: CouchDB/1.0.2 (Erlang OTP/R14B) date: Wed, 31 Jul 2013 07:29:23 GMT content-type: application/json cache-control: must-revalidate content-encoding: gzip transfer-encoding: chunked via: 1.1 project-livec993c2dc8b8c.rhcloud.com (node-web-proxy/0.4) X-C9-Server: proxy_subdomain_collab-bus2_01 </pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload