Condition parameter type does not match schema type

The following code should work. Just give the value without double quotes. The DocumentClient will automatically interpret the data type.

var docClient = new AWS.DynamoDB.DocumentClient();

var params = {
    TableName: "Contributors",
    KeyConditionExpression: "#UserId = :UserId",
    ExpressionAttributeNames: {
        "#UserId": "UserId"
    },
    ExpressionAttributeValues: {
        ":UserId": 2
    }
};

docClient.query(params, function(err, data) {
    if (err) {
        console.error("Unable to read item. Error JSON:", JSON.stringify(err,
                null, 2));
    } else {
        console.log("GetItem succeeded:", JSON.stringify(data, null, 2));
    }
});

I had the issue because of passing the data type along with the value. Just remove the data type DocumentClient will automatically interpret the data type and it works:

From:

ExpressionAttributeValues: {
 ":UserId": { "S": req.query.status }
}

To:

ExpressionAttributeValues: {
 ":UserId": req.query.status
}