Error when querying views


#1

Hi,

I keep in getting the following error:

[Error: unknown error : error parsing failed]

Here’s my pseudo code:

` var query = ViewQuery.from(‘view_doc’, ‘view_name’);

    myBucket.query(query, function(error, results) {
      console.log('error', error);
      console.log('results', results);
    });`

Any idea what I might be doing wrong? I’m not having any problems with the following code:

`myBucket.insert(“test_id”, test_data, function(error, result) {

});`


#2

Can someone give me a hand with this issue?

I’m using:

  • Version: 4.0.0-4051 Community Edition (build-4051)
  • “couchbase”: “^2.1.6”

I’ve followed the instructions in this guide, http://developer.couchbase.com/documentation/server/4.1/sdks/node-2.0/view-queries.html.


#3

Hey @agillette,
This usually occurs due to invalid results being returned from the server. Have you tried executing the query from within the Web UI?
Cheers, Brett


#4

@brett19,

Thanks for getting back to me. Yeah, I’ve verified in Couchbase that the view has been properly created and published as a production view. I clicked the “show result” button in the console and the results came back as expected.

One thing that happens when I invoke the query method is that the response times out after a while with the:

[Error: unknown error : error parsing failed]

It seems like Couchbase is either not getting the query request or that it just doesn’t respond.

BTW - My node app and Couchbase are running on AWS and I’m not having any other issues with other node sdk methods.


#5

My admin has helped me gather more info about my situation. When I perform an insert:

myBucket.insert('testId', data)

My node app connects to couchbase through port 11210 and successfully performs the insert.

But when I do a “myBucket.query”, there’s no activity on that port. Can someone shed some light on what might be going on here?

I’ve console out the “query” object and it appears to be correctly formed. I’m at a loss here.

Adrian


#6

While inserts go through port 11210 (kv) view queries go through port 8092 and n1ql through 8093! So no wonder you’re not seeing activity on 11210 when doing a view query :slight_smile:


#7

@daschl,
Thanks for your help. I’ll check with the admin to ensure that those ports are opened.


#8

@daschl,

Thanks again for your help. There was an issue with port 8092 that we resolved and now the query on the view is working.

BTW - Is there documentation on which ports are being used by couchbase and also which version of couchbase supports n1ql?