express-cassandra update function gives an "invalid amount of bind variables"

25 Views Asked by At

I have the following update service:

const editMessage = async (channelId, messageId, message) => {
    const searchByQuery = {
        id: models.timeuuidFromString(messageId),
        channelId: models.uuidFromString(channelId)
    }
    const updateQuery = {
        message,
        edited:true,
    }
    const updateAsync = util.promisify(models.instance.MessageStore.update).bind(models.instance.MessageStore);

    const updatedMessage = await updateAsync(searchByQuery,updateQuery)
    return updatedMessage;
}

However, whenever I try to run this, I get the following error: apollo.model.update.dberror: Error during update query on DB -> ResponseError: Invalid amount of bind variables On checking the query it runs the following one: query: 'UPDATE "message_store" SET "message"=?, "edited"=?, "updated_at"=toTimestamp(now()), "__v"=now() WHERE "id" = ? AND "channelId" = ?;' I am unable to check which variable is missing, since in the express-cassandra query, I am providing all the requisite ones.

I have tried changing variables to be updated, also have changed the number of vars to be updated, still no use. I have also changed the types before updating ex making id to string purposefully so and cassandra detects wrong data type but vars are kept shown missing.

0

There are 0 best solutions below