Search code examples
amazon-web-servicescassandraaws-lambdacql

MCS with AWS-Lambda returns error Consistency level LOCAL_ONE is not supported for this operation. Supported consistency levels are: LOCAL_QUORUM


I am using AWS Managed Cassandra Service(MCS) with AWS Lambda for my course project. I am trying to perform write operations and I am getting Response Errors from MCS stating Consistency level LOCAL_ONE is not supported for this operation. Supported consistency levels are: LOCAL_QUORUM. It was working fine a few days ago and I did not change anything from my Lambda function or in my MCS Keyspace. AWS Lambda and AWS MCS are hosted on us-east-2 regions. How do I solve this? Read operations are working fine. Screen Shot of the logs taken from AWS CloudWatch Management which describes the error for my query :

enter image description here


Solution

  • Add a new parameter

    { consistency: cassandra.types.consistencies.localQuorum }

    to the query execution. Below is an example of the same.

    Before-> Not Working

     addtempuser = 'INSERT into tempbotusers (mobilenumber,name,email) values (?,?,?)';
     checkaddtempuser_result = await client.execute(addtempuser,[mobilenumber,'NoName','NoEmail']);
    

    After adding the new parameter -> Working

     addtempuser = 'INSERT into tempbotusers (mobilenumber,name,email) values (?,?,?)';
     checkaddtempuser_result = await client.execute(addtempuser,[mobilenumber,'NoName','NoEmail'], { consistency: cassandra.types.consistencies.localQuorum });