title: Deleting SQS Message with Receipt Handle
body: <p>I am currently using amazon's SQS, and am having issues when trying to delete queue messages that are currently "In Flight".</p>
  
  <p>Below is some example code:</p>
  
  <pre><code>ReceiveMessageRequest queueRequest = new ReceiveMessageRequest();
          queueRequest.WithMaxNumberOfMessages(1);
          queueRequest.WithQueueUrl(config.QueueURL);
          queueRequest.WithAttributeName("All");
  
          ReceiveMessageResponse response = sqs.ReceiveMessage(queueRequest);
  
          if (response.IsSetReceiveMessageResult())
          {
              ReceiveMessageResult result = response.ReceiveMessageResult;
  
              if (result.IsSetMessage())
              {
                  if (result.Message.First() != null)
                  {
                      return new Tuple&lt;string, string, bool&gt;(result.Message.First().ReceiptHandle, result.Message.First().Body ?? null, false);
                  }
              }
          }
  </code></pre>
  
  <p>Now after receiving both the Handle, and the message body, I store the Receipt handle string into cloud storage (DynamoDB for example). I then later on load that handle out of the storage service, and call a delete with something similar to the following:</p>
  
  <pre><code>sqs.DeleteMessage(new DeleteMessageRequest() { QueueUrl = "urL", ReceiptHandle = handle });
  </code></pre>
  
  <p>However, when running that line, I receive a "The input receipt handle is invalid" error message.</p>
  
  <p>Note, I know that this message has not gotten re-received, so the receipt handle being logged, should be the most recent one. Also note that I can currently delete messages within that same application, simply by sleeping after the message is received, and then trying to delete it as above!</p>
  
  <p>Any ideas?</p>