found it — some lines after saveDoc() window.location was changed which caused this mysterious problem:
window.location = window.location.pathname; After removing that line everything works as it should. Hinnerk On Thu, Nov 18, 2010 at 6:15 PM, Hinnerk Haardt <[email protected]> wrote: > Hi, > > sometimes my CouchApp based application gets confused because CouchDB > apparently returns an empty response on PUT. > > I'm trying to save a changed document to the database using this call: > > db.saveDoc(newdoc, { > success: function() { > alert("Version " + newdoc._rev.split("-")[0] + " > erfolgreich gespeichert."); > }, > error: function(e, f) { > alert("\"" + newdoc._id + "\" nicht gespeichert! > Fehler " + e + ", " + f); > } > }); > > CouchDB responses with an empty reply and neither "success" nor > "alert" fire. Firebugs consoles reply tab displays an empty line and > Wiresharks "follow tcp stream" shows this: > > -------------------------------------------------------------------------------- > PUT /test_test/a46939051826ee4ea6428c5d5700092c HTTP/1.1 > Host: localhost:5984 > User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; > rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 > Accept: application/json, text/javascript, */* > Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 > Accept-Encoding: gzip,deflate > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > Keep-Alive: 115 > Connection: keep-alive > Content-Type: application/json; charset=UTF-8 > X-Requested-With: XMLHttpRequest > Referer: http://localhost:5984/test_test/_design/CouchTest/index.html > Content-Length: 1293 > Cookie: AuthSession=aGlubmVyazo0Q0REOEFDOTpyw3dBSwuCh0CMa0l3YRGz_JxTGw > > {"_id":"a46939051826ee4ea6428c5d5700092c","_rev":"5-c6b28cd30a3aac9f1b6a9e04f45954f6","title":"Testeintrag","content":"yupp. > -- > oder?","tags":[],"created_at":"2010-11-12T18:35:42.363Z","type":"entry","creator":"hinnerk","edited_at":"2010-11-12T18:48:39.776Z","editor":"hinnerk","_attachments":{"rev-1":{"content_type":"application/json","revpos":2,"length":272,"stub":true},"rev-2":{"content_type":"application/json","revpos":3,"length":427,"stub":true},"rev-3":{"content_type":"application/json","revpos":4,"length":507,"stub":true},"rev-5":{"content_type":"application/json","data":"eyJfaWQiOiJhNDY5MzkwNTE4MjZlZTRlYTY0MjhjNWQ1NzAwMDkyYyIsIl9yZXYiOiI1LWM2YjI4Y2QzMGEzYWFjOWYxYjZhOWUwNGY0NTk1NGY2IiwidGl0bGUiOiJUZXN0ZWludHJhZyIsImNvbnRlbnQiOiJ5dXBwLiIsInRhZ3MiOltdLCJjcmVhdGVkX2F0IjoiMjAxMC0xMS0xMlQxODozNTo0Mi4zNjNaIiwidHlwZSI6ImVudHJ5IiwiY3JlYXRvciI6Imhpbm5lcmsiLCJlZGl0ZWRfYXQiOiIyMDEwLTExLTEyVDE4OjQ1OjM4Ljc2MFoiLCJlZGl0b3IiOiJoaW5uZXJrIiwiX2F0dGFjaG1lbnRzIjp7InJldi0xIjp7ImNvbnRlbnRfdHlwZSI6ImFwcGxpY2F0aW9uL2pzb24iLCJyZXZwb3MiOjIsImxlbmd0aCI6MjcyLCJzdHViIjp0cnVlfSwicmV2LTIiOnsiY29udGVudF90eXBlIjoiYXBwbGljYXRpb24vanNvbiIsInJldnBvcyI6MywibGVuZ3RoIjo0MjcsInN0dWIiOnRydWV9LCJyZXYtMyI6eyJjb250ZW50X3R5cGUiOiJhcHBsaWNhdGlvbi9qc29uIiwicmV2cG9zIjo0LCJsZW5ndGgiOjUwNywic3R1YiI6dHJ1ZX19fQo="}}}HTTP/1.1 > 201 Created > Server: CouchDB/1.0.1 (Erlang OTP/R14B) > Location: http://localhost:5984/test_test/a46939051826ee4ea6428c5d5700092c > Etag: "6-fd1d949fe9bd1f09b5d254a88c18ad0e" > Date: Fri, 12 Nov 2010 18:48:39 GMT > Content-Type: application/json > Content-Length: 95 > Cache-Control: must-revalidate > > -------------------------------------------------------------------------------- > > There's nothing obviously wrong in the debug log (note: this debug log > is a bit newer than the above network dump): > > [debug] [<0.6284.0>] 'GET' > /test_test/_design/CouchTest/_view/tags?group_level=1 {1,1} from > "127.0.0.1" > Headers: [{'Accept',"application/json, text/javascript, */*"}, > {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"de-de,de;q=0.8,en-us;q=0.5,en;q=0.3"}, > {'Connection',"keep-alive"}, > {'Content-Type',"application/json"}, > > {'Cookie',"AuthSession=aGlubmVyazo0Q0U1NDY2NzrZKVt02Z_znPZtFnXDlNvXr9nw1Q"}, > {'Host',"localhost:5984"}, > {'If-None-Match',"\"61A4Y694CMIG602LZX6S6EUNF\""}, > {'Keep-Alive',"115"}, > > {'Referer',"http://localhost:5984/test_test/_design/CouchTest/index.html"}, > {'User-Agent',"Mozilla/5.0 (Macintosh; U; Intel Mac OS X > 10.6; de; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12"}, > {"X-Requested-With","XMLHttpRequest"}] > [debug] [<0.6284.0>] OAuth Params: [{"group_level","1"}] > [debug] [<0.6284.0>] timeout 43200 > [debug] [<0.6284.0>] Successful cookie auth as: "hinnerk" > [debug] [<0.6284.0>] request_group {Pid, Seq} {<0.201.0>,690} > [debug] [<0.6284.0>] request_group {Pid, Seq} {<0.201.0>,690} > [info] [<0.6284.0>] 127.0.0.1 - - 'GET' > /test_test/_design/CouchTest/_view/tags?group_level=1 304 > [debug] [<0.6288.0>] 'PUT' /test_test/a46939051826ee4ea6428c5d5700092c > {1,1} from "127.0.0.1" > Headers: [{'Accept',"application/json, text/javascript, */*"}, > {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"de-de,de;q=0.8,en-us;q=0.5,en;q=0.3"}, > {'Connection',"keep-alive"}, > {'Content-Length',"4805"}, > {'Content-Type',"application/json; charset=UTF-8"}, > > {'Cookie',"AuthSession=aGlubmVyazo0Q0U1NDY2NzrZKVt02Z_znPZtFnXDlNvXr9nw1Q"}, > {'Host',"localhost:5984"}, > {'Keep-Alive',"115"}, > > {'Referer',"http://localhost:5984/test_test/_design/CouchTest/index.html"}, > {'User-Agent',"Mozilla/5.0 (Macintosh; U; Intel Mac OS X > 10.6; de; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12"}, > {"X-Requested-With","XMLHttpRequest"}] > [debug] [<0.6287.0>] 'GET' /test_test/_design/CouchTest/index.html > {1,1} from "127.0.0.1" > Headers: > [{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, > {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"de-de,de;q=0.8,en-us;q=0.5,en;q=0.3"}, > {'Connection',"keep-alive"}, > > {'Cookie',"AuthSession=aGlubmVyazo0Q0U1NDY2NzrZKVt02Z_znPZtFnXDlNvXr9nw1Q"}, > {'Host',"localhost:5984"}, > {'If-None-Match',"\"531-f6974bcc0c5d2d7836df7162fdf9507a\""}, > {'Keep-Alive',"115"}, > > {'Referer',"http://localhost:5984/test_test/_design/CouchTest/index.html"}, > {'User-Agent',"Mozilla/5.0 (Macintosh; U; Intel Mac OS X > 10.6; de; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12"}] > [debug] [<0.6288.0>] OAuth Params: [] > [debug] [<0.6287.0>] OAuth Params: [] > [debug] [<0.6288.0>] timeout 43200 > [debug] [<0.6287.0>] timeout 43200 > [debug] [<0.6288.0>] Successful cookie auth as: "hinnerk" > [debug] [<0.6287.0>] Successful cookie auth as: "hinnerk" > [info] [<0.6288.0>] 127.0.0.1 - - 'PUT' > /test_test/a46939051826ee4ea6428c5d5700092c 201 > [info] [<0.6287.0>] 127.0.0.1 - - 'GET' > /test_test/_design/CouchTest/index.html 304 > [debug] [<0.6286.0>] 'GET' > /test_test/_design/CouchTest/style/ui-lightness/jquery-ui-1.8.6.custom.css > {1, > > 1} from "127.0.0.1" > Headers: [{'Accept',"text/css,*/*;q=0.1"}, > {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"de-de,de;q=0.8,en-us;q=0.5,en;q=0.3"}, > {'Connection',"keep-alive"}, > > {'Cookie',"AuthSession=aGlubmVyazo0Q0U1NDY2NzrZKVt02Z_znPZtFnXDlNvXr9nw1Q"}, > {'Host',"localhost:5984"}, > {'If-None-Match',"\"531-f6974bcc0c5d2d7836df7162fdf9507a\""}, > {'Keep-Alive',"115"}, > > {'Referer',"http://localhost:5984/test_test/_design/CouchTest/index.html"}, > {'User-Agent',"Mozilla/5.0 (Macintosh; U; Intel Mac OS X > 10.6; de; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12"}] > [debug] [<0.6285.0>] 'GET' /test_test/_design/CouchTest/style/main.css > {1,1} from "127.0.0.1" > Headers: [{'Accept',"text/css,*/*;q=0.1"}, > {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"de-de,de;q=0.8,en-us;q=0.5,en;q=0.3"}, > {'Connection',"keep-alive"}, > > {'Cookie',"AuthSession=aGlubmVyazo0Q0U1NDY2NzrZKVt02Z_znPZtFnXDlNvXr9nw1Q"}, > {'Host',"localhost:5984"}, > {'If-None-Match',"\"531-f6974bcc0c5d2d7836df7162fdf9507a\""}, > {'Keep-Alive',"115"}, > > {'Referer',"http://localhost:5984/test_test/_design/CouchTest/index.html"}, > {'User-Agent',"Mozilla/5.0 (Macintosh; U; Intel Mac OS X > 10.6; de; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12"}] > [debug] [<0.6284.0>] 'GET' > /test_test/_design/CouchTest/vendor/couchapp/loader.js {1,1} from > "127.0.0.1" > Headers: [{'Accept',"*/*"}, > {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"de-de,de;q=0.8,en-us;q=0.5,en;q=0.3"}, > {'Connection',"keep-alive"}, > > {'Cookie',"AuthSession=aGlubmVyazo0Q0U1NDY2NzrZKVt02Z_znPZtFnXDlNvXr9nw1Q"}, > {'Host',"localhost:5984"}, > {'If-None-Match',"\"531-f6974bcc0c5d2d7836df7162fdf9507a\""}, > {'Keep-Alive',"115"}, > > {'Referer',"http://localhost:5984/test_test/_design/CouchTest/index.html"}, > {'User-Agent',"Mozilla/5.0 (Macintosh; U; Intel Mac OS X > 10.6; de; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12"}] > [debug] [<0.6286.0>] OAuth Params: [] > [debug] [<0.6285.0>] OAuth Params: [] > [debug] [<0.6284.0>] OAuth Params: [] > [debug] [<0.6286.0>] timeout 43200 > [debug] [<0.6285.0>] timeout 43200 > [debug] [<0.6284.0>] timeout 43200 > [debug] [<0.6286.0>] Successful cookie auth as: "hinnerk" > [debug] [<0.6285.0>] Successful cookie auth as: "hinnerk" > [debug] [<0.6284.0>] Successful cookie auth as: "hinnerk" > [info] [<0.6286.0>] 127.0.0.1 - - 'GET' > /test_test/_design/CouchTest/style/ui-lightness/jquery-ui-1.8.6.custom.css > 304 > [info] [<0.6285.0>] 127.0.0.1 - - 'GET' > /test_test/_design/CouchTest/style/main.css 304 > [info] [<0.6284.0>] 127.0.0.1 - - 'GET' > /test_test/_design/CouchTest/vendor/couchapp/loader.js 304 > [debug] [<0.6287.0>] 'GET' > /test_test/_design/CouchTest/scripts/jquery-ui-1.8.6.custom.min.js > {1,1} from "127.0.0.1" > Headers: [{'Accept',"*/*"}, > {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"de-de,de;q=0.8,en-us;q=0.5,en;q=0.3"}, > {'Connection',"keep-alive"}, > > {'Cookie',"AuthSession=aGlubmVyazo0Q0U1NDY2NzrZKVt02Z_znPZtFnXDlNvXr9nw1Q"}, > {'Host',"localhost:5984"}, > {'If-None-Match',"\"531-f6974bcc0c5d2d7836df7162fdf9507a\""}, > {'Keep-Alive',"115"}, > > {'Referer',"http://localhost:5984/test_test/_design/CouchTest/index.html"}, > {'User-Agent',"Mozilla/5.0 (Macintosh; U; Intel Mac OS X > 10.6; de; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12"}] > [debug] [<0.6287.0>] OAuth Params: [] > [debug] [<0.6287.0>] timeout 43200 > [debug] [<0.6287.0>] Successful cookie auth as: "hinnerk" > [info] [<0.6287.0>] 127.0.0.1 - - 'GET' > /test_test/_design/CouchTest/scripts/jquery-ui-1.8.6.custom.min.js 304 > > > I've tried to reproduce it on different versions (1.0.1, svn-1036440) > and platforms (Mac/Intel, Linux/Intel). It seems setting [log] > level=debug makes it work in 1.0.1 but not in the current svn revision > (1036440). Setting [log] level=info seems to always expose this > behavior. > > Has anyone seen anything similar? Any ideas? > > If not I'll try do extract a minimal design doc reproducing it and > create a database that I can share. > > > Hinnerk >
