AWS SQS AWS.SimpleQueueService.InvalidDelaySeconds error encountered when setting delay seconds for a message.

The delay seconds value provided is outside the valid range.

Understanding AWS SQS

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead associated with managing and operating message-oriented middleware, and empowers developers to focus on differentiating work.

Identifying the Symptom

When using AWS SQS, you might encounter the error code AWS.SimpleQueueService.InvalidDelaySeconds. This error typically occurs when you attempt to set a delay for a message that is outside the permissible range.

What You Observe

Upon attempting to send a message with a delay, the operation fails, and you receive an error message indicating an invalid delay seconds value.

Understanding the Issue

The error code AWS.SimpleQueueService.InvalidDelaySeconds indicates that the delay seconds value specified is not within the allowed range. AWS SQS allows you to set a delay of up to 900 seconds (15 minutes) for a message. This feature is useful for postponing the delivery of messages to the queue.

Why This Happens

This error occurs when the delay seconds value is set to a number less than 0 or greater than 900. The delay seconds parameter must be an integer within this range.

Steps to Fix the Issue

To resolve this issue, ensure that the delay seconds value is correctly set within the valid range.

Actionable Steps

  1. Review the code or configuration where the delay seconds are being set.
  2. Ensure that the value is an integer between 0 and 900.
  3. Update the code or configuration to use a valid delay seconds value.
  4. Test the message sending operation again to confirm that the issue is resolved.

Example Code

Here is an example of setting a valid delay seconds value using the AWS SDK for Python (Boto3):

import boto3

sqs = boto3.client('sqs')

response = sqs.send_message(
QueueUrl='https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue',
MessageBody='Hello, world!',
DelaySeconds=300 # Valid delay seconds
)
print(response)

Additional Resources

For more information on AWS SQS and its features, refer to the following resources:

Never debug

AWS SQS

manually again

Let Dr. Droid create custom investigation plans for your infrastructure.

Book Demo
Automate Debugging for
AWS SQS
See how Dr. Droid creates investigation plans for your infrastructure.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid