Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Unexpected message QUERY, expecting CREDENTIALS' #44

Closed
paullryan opened this issue Dec 12, 2013 · 10 comments
Closed

'Unexpected message QUERY, expecting CREDENTIALS' #44

paullryan opened this issue Dec 12, 2013 · 10 comments
Labels

Comments

@paullryan
Copy link

Using cassandra 2.0.1 I'm getting the error message from the title.

I'm using the following to initialize the connection:

var client = new cql.Client({
    hosts: hosts,
    username: dbConfig.username,
    password: dbConfig.password,
    keyspace: dbConfig.keyspace,
    maxExecuteRetries: 10,
    getAConnectionTimeout: dbConfig.timeout
});
client.connect(function(error, response){
    console.log('error - ' + error);
    console.log(error);
    console.log('response - ' + response);
});

The response is:

error - PoolConnectionError
{ name: 'PoolConnectionError',
  info: 'Represents a error while trying to connect the pool, all the connections failed.',
  individualErrors: 
   [ { name: 'ResponseError',
       message: 'Unexpected message QUERY, expecting CREDENTIALS',
       info: 'Represents a error message from the server',
       code: 10,
       isServerUnhealthy: false } ] }
response - undefined

It would appear it's expecting a credentials frame rather than a query frame. Any suggestions on getting a connection?

Also I am able to connect to this server from cqlsh on the machine I'm running node from.

@jorgebay
Copy link
Owner

Hi!
Which version are you using of the driver?

@jorgebay
Copy link
Owner

I found the bug. It looks like when the username / password are incorrect, instead of callback with the auth error, it continues to try to "USE" the keyspace.

I think for now, you can check if the credentials you are passing are correct.
Tomorrow I will fix this issue

@paullryan
Copy link
Author

Hi Jorge,

Looks like I'm using 0.2.11 according to package.json. I just did and update to be sure I was on the latest.

@paullryan
Copy link
Author

Ok thanks.

@paullryan
Copy link
Author

My connection succeeds when using cqlsh (thrift) with the following message (same credentials as passed into the node client):

Connected to Test Cluster at <myip>:9160.
[cqlsh 4.1.0 | Cassandra 2.0.1 | CQL spec 3.1.1 | Thrift protocol 19.37.0]

The only difference is that I'm using the native port 9042 for the node client.

@paullryan
Copy link
Author

Given your statement I found the spot in startupcallback that your saying didn't have the right error handler. When I put a handler there the message is:

{ name: 'ResponseError',
  message: 'Required key \'username\' is missing',
  info: 'Represents a error message from the server',
  code: 256,
  isServerUnhealthy: false }

Which is odd as this.options.username and this.options.password are populated with the correct username and password in Connection.authenticate.

@jorgebay
Copy link
Owner

That narrows it down...
Great!

@paullryan
Copy link
Author

Ok found an issue with 2.0.1 from https://issues.apache.org/jira/browse/CASSANDRA-6203 and was fixed for the latest. Thanks for the help in finding the real error message. I'll leave this open for the printing of the real error from startupcallback.

@jorgebay
Copy link
Owner

Thanks!
Anyway, there is still a bug in the driver: the error message returned needs to be the correct one.

I'll fix it during the day

@jorgebay
Copy link
Owner

Now fixed, added a unit test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants