title: Multiple Validation Errors Aws SDK
body: <p>I am working on lambda function and creating a method for AWS-SDK historical metric report using node, js and I am getting the following errors.
  Have look at a SS of error
  <a href="https://i.stack.imgur.com/b5fwv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b5fwv.png" alt="enter image description here" /></a></p>
  <p>here is my code</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getKeyByValue(object, value) { 
      return Object.keys(object).find(key =&gt;  
              object[key] === value); 
  } 
  exports.handler = async (event) =&gt; {
      const AWS = require('aws-sdk');
      var connect = new AWS.Connect({ apiVersion: '2017-08-08' });
      let queueARN = event.queueARN || null;
      const connectInstanceId = process.env.instanceID;
      let flag =0, nextToken = null;
      let queueARNsObject = {}, queueARNsArray=[], queueTypeObject={};
      do{
          let listQueuesParams = {
              InstanceId: connectInstanceId, /* required */
              QueueTypes: [
                  "STANDARD",
              ],
              NextToken: nextToken,
          };
          let listQueuesPromise = connect.listQueues(listQueuesParams).promise();
          listQueuesResult = await listQueuesPromise;
          // console.log(listQueuesResult);
          listQueuesResult.QueueSummaryList.forEach(queue =&gt; {
              if(queueARN != null){
                  if (queue.Arn == queueARN){
                      queueARNsArray = [queue.Arn];  
                      queueARNsObject[queue.Name]= queue.Arn;
                      queueTypeObject[queue.QueueType]= queue.Arn;
                      flag = 1;
                      return;
                  }
              }else{
                  queueARNsObject[queue.Name]= queue.Arn;
                  queueTypeObject[queue.QueueType]= queue.Arn;
                  queueARNsArray.push(queue.Arn);
                  nextToken = listQueuesResult.NextToken;
  
              }
          });
          
      }while (flag=0 &amp;&amp; nextToken != null);
      const metricsList = [
          {
              Name : 'CONTACTS_HANDLED',
              Unit : 'COUNT',
              Statistic : 'SUM'
          },
          {
              Name : 'CONTACTS_ABANDONED',
              Unit : 'COUNT',
              Statistic : 'SUM'
          },
        ];
      // Metrics params
      var getMetricParams = {
          InstanceId: connectInstanceId,
          StartTime: 1592854200,
          EndTime: 1592855700,
          Filters: {
              Channels: ["VOICE"],
              Queues: queueARNsArray
          },
          CurrentMetrics: metricsList,
          Groupings: ["QUEUE"]
      };
      // get current metrics by queues
      var getMetricsPromise = connect
          .getMetricData(getMetricParams)
          .promise();
      var getMetricsResult = await getMetricsPromise;
      // console.log("current |||||||| 1 metrics:", JSON.stringify(getCurrentMetricsResult));
      let queueMetricsArray = [];
      if(getMetricsResult.MetricResults.length){
          getMetricsResult.MetricResults.forEach(queue =&gt; {
              let queueMetrics = {
                  "Queue_Name" : getKeyByValue(queueARNsObject ,queue.Dimensions.Queue.Arn),
                  "CallsHandled": queue.Collections[0].Value , 
                  "CallsAbanoded": queue.Collections[1].Value , 
              }
              queueMetricsArray.push(queueMetrics);
              console.log("TYPE||||", getKeyByValue(queueTypeObject ,queue.Dimensions.Queue.Arn))
          });
      }else{
          keys.forEach(key =&gt; {
              let queueMetrics = {
                  "Queue_Name" : getKeyByValue(event ,queue.Dimensions.Queue.Arn),
                  "CONTACTS_HANDLED": 0,
                  "CONTACTS_ABANDONED": 0
              }
              queueMetricsArray.push(queueMetrics);
          })
      }
  
      const response = {
          responseCode: 200,
          metricResults: queueMetricsArray
      };
      return response;
  
  };</code></pre>
  </div>
  </div>
  </p>
  <p>I don't have any idea what this is an error about. if anyone of you knows please help me to fix it Thanks.
  I don't know where the Missing required key 'HistoricalMetrics' in params&quot; I've checked the params but I didn't get anything.</p>