InvalidParameterValue
aws
config_error
ai_generated
true
An error occurred (InvalidParameterValue) when calling the SendMessage operation: Value for parameter MessageRetentionPeriod is not valid. Must be between 60 and 1209600 seconds
ID: aws/sqs-message-retention-period-exceeded
92%Fix Rate
88%Confidence
1Evidence
2023-09-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Amazon SQS API 2012-11-05 | active | — | — | — |
| AWS SDK for Java 2.20.0 | active | — | — | — |
Root Cause
The SQS queue's message retention period was set outside the allowed range (60 seconds to 14 days), causing send or update operations to fail.
generic中文
SQS 队列的消息保留期被设置在允许范围(60 秒到 14 天)之外,导致发送或更新操作失败。
Official Documentation
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SetQueueAttributes.htmlWorkarounds
-
95% success Set the MessageRetentionPeriod to a valid value between 60 and 1209600 seconds. For example, use the AWS CLI: 'aws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue --attributes MessageRetentionPeriod=345600' (4 days).
Set the MessageRetentionPeriod to a valid value between 60 and 1209600 seconds. For example, use the AWS CLI: 'aws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue --attributes MessageRetentionPeriod=345600' (4 days).
-
90% success If the queue was created with an invalid retention period, delete and recreate the queue with a valid value: 'aws sqs create-queue --queue-name MyQueue --attributes MessageRetentionPeriod=86400' (1 day).
If the queue was created with an invalid retention period, delete and recreate the queue with a valid value: 'aws sqs create-queue --queue-name MyQueue --attributes MessageRetentionPeriod=86400' (1 day).
中文步骤
将 MessageRetentionPeriod 设置为 60 到 1209600 秒之间的有效值。例如,使用 AWS CLI:'aws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue --attributes MessageRetentionPeriod=345600'(4 天)。
如果队列是使用无效的保留期创建的,请删除并重新创建具有有效值的队列:'aws sqs create-queue --queue-name MyQueue --attributes MessageRetentionPeriod=86400'(1 天)。
Dead Ends
Common approaches that don't work:
-
30% fail
Setting the retention period to exactly 60 seconds or 1209600 seconds may still fail if the queue already exists with a different value; the update might require a queue recreation.
-
20% fail
Trying to set the retention period via the console without refreshing the queue attributes might use a cached, invalid value from a previous configuration.