title: Resend message to SQS queue - Node JS
body: <p>I am consuming a sqs message and handling it using sqs-consumer library and handling in a file</p>
  <pre><code>const { Consumer } = require('sqs-consumer');
  module.exports = ({
    queueUrl,
    handleMessage,
    visibilityTimeout = parseInt(process.env.QUEUE_VISIBILITY_TIMEOUT, 10),
  }) =&gt; (
    Consumer.create({
      queueUrl,
      handleMessage,
      visibilityTimeout,
    })
  );
  </code></pre>
  <p>Handler:</p>
  <pre><code>    module.exports = withMessageVisibility(queueUrl)(async (message) =&gt; {
    const {
      noteId,
    } = JSON.parse(message.Body);
  
    const timestampLogger = new TimestampLogger({ entityId: noteId, messageId: message.MessageId, entityName: 'clip' });
  
    logger.info(`Processing message [MessageID: ${message.MessageId}], [ReceiptHandle: ${message.ReceiptHandle}] [MD5OfBody]: ${message.MD5OfBody} [noteId=${noteId}]`);
    let sqsInterval;
    try {
      // Starting time for complete clip project
      timestampLogger.setStartTime();
      const note = await TestSessionNote.findById(noteId);
      timestampLogger.setEndTime('Find TestSessionNote');
      if (!note) {
        throw new Error('find note error: note not found');
      }
      const {
        totalExecutionTime, isSuccess, failureReason, stepLogs,
      } = timestampLogger.setEndTime('Main', true);
      const totalElapsedTime = timestampLogger.getTotalElapsedTime({
        totalExecutionTime, isSuccess, failureReason, operationName: 'Clip', serviceName: 'clip.js',
      });
      await PlaybookuxServiceLogs.insert(totalElapsedTime, stepLogs);
      logger.info(`Finished processing message - [MessageID: ${message.MessageId}], [ReceiptHandle: ${message.ReceiptHandle}] [MD5OfBody]: ${message.MD5OfBody} [noteId=${noteId}]`);
    } catch (error) {
      clearInterval(sqsInterval);
      logger.error(`Error processing message - [MessageID: ${message.MessageId}], [ReceiptHandle: ${message.ReceiptHandle}] [MD5OfBody]: ${message.MD5OfBody} [noteId=${noteId}]`, error);
    }
  });
  </code></pre>
  <p>My goal is: if my code reach the catch block, i want to resend the same message to the queue again (in my code, i'm just clearing interval and loggin)...</p>
  <p>I tried to use AWS.sqs.sendMessage function <a href="https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/sqs-examples-send-receive-messages.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/sqs-examples-send-receive-messages.html</a> but i don't know if this approach execute the same message with same ids, or if i send another message to the queue</p>
  <p>Can anyone help?</p>