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
TypeError: Cannot read property 'key' of undefined #28
Comments
Thanks for the bug report. It looks like a legit bug. Currently our code discovers all the available column families (using describe_keyspace) and builds validators for them when it successfully establish a connection to Cassandra. This won't work if you create a new column family and as a part of the same session execute a query which operates on this new column family. I will think about it and try to come up with a more efficient solution which doesn't require consistently using describe_keyspace. |
Hi, Thanks for the clarification. It turns out that reconnecting after creating a column family is a simple workaround! The big picture, BTW, is that I'm writing unit tests for my code, and what I generally do is set up and teardown a complete environment for each test, which includes entire keyspaces. Since this is probably an edge case, instead of re-architecting your stuff, may I suggest an alternative? How about logic like this:
All the best, -- Doug |
Hmm, I may have found something else related to the current issue. Take a look at this debug output:
BUT, this doesn't always happen 100% of the time. Also, the CREATE COLUMNFAMILY and UPDATE statements work just run when I do them from cqlsh on the command line. I'm still getting the hang of Cassandra, so again please let me know if I'm doing anything improperly here. Thanks, -- Doug |
Yeah, reconnecting when creating a column family is definitely one of the options, but it's not the most efficient one :) I will also wait for @gdusbabek, maybe he has a better solution in mind. |
@dmuth your idea about setting a flag to indicate that meta information should be re-collected is a good idea. As far as the subsequent error, it looks like it is coming from from Cassandra. Are there exceptions in the cassandra log that correspond with the error you see? |
Oddly enough, I tried writing a separate test case for the second issue, but was unable to reproduce it. Then I went back to my first test case, and was unable to reproduce it there. Since I'm still learning Cassandra (both client side and server side admin...), I think I can I classify that as a case of PEBKAC on my part. :-) If you gentlemen would like to keep this bug open or closed, that's up to you. I found a workaround which works for my specific case. -- Doug |
/var/service/node_modules/cassandra-client/node_modules/thrift/lib/thrift/connection.js:90 |
Happened to me, too. : ( |
@Bedtimes, can you verify that the keyspace and column family exist? |
Hey Guys, I am running in with the same problem. TypeError: Cannot read property 'key' of undefined I have defined the CF and the keyspace. The insert works perfectly, but it's the select which is the problem. So is this bug still open, or it has been fixed and I am making some silly error in my code. I am using node v0.10.5 and Cassandra 1.2.5. |
@shroffrushabh This bug is definitely still open. I'm taking another look at it to see if I can come up with a fix. |
Thank you, I switched to using python flask because of this. Hope you fix it so I can use Node again. |
Wow, all of Node is riding on this. We really need to fix this one. |
Good Evening,
I'm running the latest version of this module, node.js 0.6.11, and Cassandra 1.1.0.
I am able to consistently get this error to happen with the following CQL:
log event: cql -- "CREATE KEYSPACE test_keyspace WITH strategy_class = 'SimpleStrategy' AND strategy_options:replication_factor=1"
log event: info -- "connecting 10.244.207.16:9160(3)"
log event: cql -- "SELECT * FROM 'test1' "
log event: cql -- "CREATE COLUMNFAMILY test1 (id uuid PRIMARY KEY) "
log event: cql -- "UPDATE test1 SET name='Doug', num='123' WHERE id = '1d30f3f2-8435-4ea0-8e33-59c5f5a198b5'"
log event: cql -- "SELECT * FROM test1"
When I issue that SELECT, I get this error:
That's a little um, surprising. :-)
I dug into things a little deeper and put some debug code into thrift/lib/thrift/connection.js. I saw that I am in fact fetching the data successfully from Cassandra, but for whatever reason, this.validators is undefined at line 205 in decoder.js.
Is there anything else I can try on my end to get this to work?
Thanks for your time,
-- Doug
The text was updated successfully, but these errors were encountered: