You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Alexander Shorin (JIRA)" <ji...@apache.org> on 2011/09/06 16:36:10 UTC

[jira] [Created] (COUCHDB-1272) Shows list api with provides doesn't works

Shows list api with provides doesn't works
------------------------------------------

                 Key: COUCHDB-1272
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1272
             Project: CouchDB
          Issue Type: Bug
          Components: JavaScript View Server
    Affects Versions: 1.0.3, 1.1
            Reporter: Alexander Shorin


Steps to reproduce:

1. Create show function:
function(doc, req){
  provides('text', function(){
    send('foo, ');
    send('bar, ');
    return 'baz!';
  })
}

2. Make GET request to next resource:
http://localhost:5984/test/_design/foo/_show/send?format=text

3. Response would be 'baz!', but 'foo, bar, baz!' expected.

4. However, show function:
function(doc, req){
    start({'Content-Type': 'text/plain'})
    send('foo, ');
    send('bar, ');
    return 'baz!';
}
will return correct result.

5. And show function:
function(doc, req){
  provides('text', function(){
    send('foo, ');
    send('bar, ');
    send('baz!');
  })
}
will raise an TypeError expection:
{
    error: "render_error"
    reason: "function raised error: (new TypeError("resp is undefined", "/usr/share/couchdb/server/main.js", 817)) stacktrace: applyContentType((void 0),"text/plain; charset=utf-8")@/usr/share/couchdb/server/main.js:817 runShow(function (doc, req) {provides("text", function () {send("foo, ");send("bar, ");send("baz!");});},[object Object],[object Array])@/usr/share/couchdb/server/main.js:903 (function (doc, req) {provides("text", function () {send("foo, ");send("bar, ");send("baz!");});},[object Object],[object Array])@/usr/share/couchdb/server/main.js:991 ("_design/foo",[object Array],[object Array])@/usr/share/couchdb/server/main.js:1432 ()@/usr/share/couchdb/server/main.js:1475 @/usr/share/couchdb/server/main.js:1486 "
}

Both problem functions [1] and [5] works well if they are defined as list functions.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (COUCHDB-1272) Shows list api with provides doesn't works

Posted by "Jan Lehnardt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1272?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Lehnardt resolved COUCHDB-1272.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2
                   1.1.1

Looks good, applied, thanks!

> Shows list api with provides doesn't works
> ------------------------------------------
>
>                 Key: COUCHDB-1272
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1272
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 1.1, 1.0.3
>            Reporter: Alexander Shorin
>            Assignee: Jan Lehnardt
>             Fix For: 1.1.1, 1.2
>
>         Attachments: render.patch
>
>
> Steps to reproduce:
> 1. Create show function:
> function(doc, req){
>   provides('text', function(){
>     send('foo, ');
>     send('bar, ');
>     return 'baz!';
>   })
> }
> 2. Make GET request to next resource:
> http://localhost:5984/test/_design/foo/_show/send?format=text
> 3. Response would be 'baz!', but 'foo, bar, baz!' expected.
> 4. However, show function:
> function(doc, req){
>     start({'Content-Type': 'text/plain'})
>     send('foo, ');
>     send('bar, ');
>     return 'baz!';
> }
> will return correct result.
> 5. And show function:
> function(doc, req){
>   provides('text', function(){
>     send('foo, ');
>     send('bar, ');
>     send('baz!');
>   })
> }
> will raise an TypeError expection:
> {
>     error: "render_error"
>     reason: "function raised error: (new TypeError("resp is undefined", "/usr/share/couchdb/server/main.js", 817)) stacktrace: applyContentType((void 0),"text/plain; charset=utf-8")@/usr/share/couchdb/server/main.js:817 runShow(function (doc, req) {provides("text", function () {send("foo, ");send("bar, ");send("baz!");});},[object Object],[object Array])@/usr/share/couchdb/server/main.js:903 (function (doc, req) {provides("text", function () {send("foo, ");send("bar, ");send("baz!");});},[object Object],[object Array])@/usr/share/couchdb/server/main.js:991 ("_design/foo",[object Array],[object Array])@/usr/share/couchdb/server/main.js:1432 ()@/usr/share/couchdb/server/main.js:1475 @/usr/share/couchdb/server/main.js:1486 "
> }
> Both problem functions [1] and [5] works well if they are defined as list functions.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (COUCHDB-1272) Shows list api with provides doesn't works

Posted by "Jan Lehnardt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1272?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Lehnardt reassigned COUCHDB-1272:
-------------------------------------

    Assignee: Jan Lehnardt

> Shows list api with provides doesn't works
> ------------------------------------------
>
>                 Key: COUCHDB-1272
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1272
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 1.1, 1.0.3
>            Reporter: Alexander Shorin
>            Assignee: Jan Lehnardt
>
> Steps to reproduce:
> 1. Create show function:
> function(doc, req){
>   provides('text', function(){
>     send('foo, ');
>     send('bar, ');
>     return 'baz!';
>   })
> }
> 2. Make GET request to next resource:
> http://localhost:5984/test/_design/foo/_show/send?format=text
> 3. Response would be 'baz!', but 'foo, bar, baz!' expected.
> 4. However, show function:
> function(doc, req){
>     start({'Content-Type': 'text/plain'})
>     send('foo, ');
>     send('bar, ');
>     return 'baz!';
> }
> will return correct result.
> 5. And show function:
> function(doc, req){
>   provides('text', function(){
>     send('foo, ');
>     send('bar, ');
>     send('baz!');
>   })
> }
> will raise an TypeError expection:
> {
>     error: "render_error"
>     reason: "function raised error: (new TypeError("resp is undefined", "/usr/share/couchdb/server/main.js", 817)) stacktrace: applyContentType((void 0),"text/plain; charset=utf-8")@/usr/share/couchdb/server/main.js:817 runShow(function (doc, req) {provides("text", function () {send("foo, ");send("bar, ");send("baz!");});},[object Object],[object Array])@/usr/share/couchdb/server/main.js:903 (function (doc, req) {provides("text", function () {send("foo, ");send("bar, ");send("baz!");});},[object Object],[object Array])@/usr/share/couchdb/server/main.js:991 ("_design/foo",[object Array],[object Array])@/usr/share/couchdb/server/main.js:1432 ()@/usr/share/couchdb/server/main.js:1475 @/usr/share/couchdb/server/main.js:1486 "
> }
> Both problem functions [1] and [5] works well if they are defined as list functions.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (COUCHDB-1272) Shows list api with provides doesn't works

Posted by "Alexander Shorin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1272?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Shorin updated COUCHDB-1272:
--------------------------------------

    Attachment: render.patch

Possible solution. It also prevents of losing returned value if provides used. See `list-api-provides-and-return` function for example case.

> Shows list api with provides doesn't works
> ------------------------------------------
>
>                 Key: COUCHDB-1272
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1272
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 1.1, 1.0.3
>            Reporter: Alexander Shorin
>            Assignee: Jan Lehnardt
>         Attachments: render.patch
>
>
> Steps to reproduce:
> 1. Create show function:
> function(doc, req){
>   provides('text', function(){
>     send('foo, ');
>     send('bar, ');
>     return 'baz!';
>   })
> }
> 2. Make GET request to next resource:
> http://localhost:5984/test/_design/foo/_show/send?format=text
> 3. Response would be 'baz!', but 'foo, bar, baz!' expected.
> 4. However, show function:
> function(doc, req){
>     start({'Content-Type': 'text/plain'})
>     send('foo, ');
>     send('bar, ');
>     return 'baz!';
> }
> will return correct result.
> 5. And show function:
> function(doc, req){
>   provides('text', function(){
>     send('foo, ');
>     send('bar, ');
>     send('baz!');
>   })
> }
> will raise an TypeError expection:
> {
>     error: "render_error"
>     reason: "function raised error: (new TypeError("resp is undefined", "/usr/share/couchdb/server/main.js", 817)) stacktrace: applyContentType((void 0),"text/plain; charset=utf-8")@/usr/share/couchdb/server/main.js:817 runShow(function (doc, req) {provides("text", function () {send("foo, ");send("bar, ");send("baz!");});},[object Object],[object Array])@/usr/share/couchdb/server/main.js:903 (function (doc, req) {provides("text", function () {send("foo, ");send("bar, ");send("baz!");});},[object Object],[object Array])@/usr/share/couchdb/server/main.js:991 ("_design/foo",[object Array],[object Array])@/usr/share/couchdb/server/main.js:1432 ()@/usr/share/couchdb/server/main.js:1475 @/usr/share/couchdb/server/main.js:1486 "
> }
> Both problem functions [1] and [5] works well if they are defined as list functions.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira