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

The delay seconds value provided is outside the acceptable 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 working with AWS SQS, you might encounter the error code AWS.SimpleQueueService.InvalidDelaySeconds. This error typically arises when attempting to set a delay for a message that is outside the permissible range.

What You Observe

Developers may notice that their application fails to send messages to an SQS queue, and the error message indicates an invalid delay seconds value.

Delving into the Issue

The error code AWS.SimpleQueueService.InvalidDelaySeconds indicates that the delay seconds value specified is not within the acceptable range. AWS SQS allows you to set a delay for a message, which postpones its availability for processing. However, this delay must be between 0 and 900 seconds (15 minutes).

Why This Happens

This issue occurs when the delay seconds parameter is set to a value less than 0 or greater than 900. It is crucial to ensure that the delay is within this range to avoid errors.

Steps to Resolve the Issue

To fix the AWS.SimpleQueueService.InvalidDelaySeconds error, follow these steps:

Step 1: Verify the Delay Seconds Value

Check the delay seconds value you are setting for your SQS message. Ensure it is within the range of 0 to 900 seconds. For example, if you are using the AWS SDK for Python (Boto3), your code might look like this:

import boto3

sqs = boto3.client('sqs')

response = sqs.send_message(
QueueUrl='YOUR_QUEUE_URL',
MessageBody='Your message body',
DelaySeconds=10 # Ensure this is between 0 and 900
)

Step 2: Update Your Code

If the delay seconds value is incorrect, update your code to set a valid value. For example, if you initially set it to 1000, change it to a value within the permissible range, such as 300.

Step 3: Test Your Changes

After updating the delay seconds value, test your application to ensure that messages are being sent to the SQS queue without errors.

Additional Resources

For more information on using AWS SQS and handling messages, 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