Error code returned by ChangeMessageVisibility isn't mentioned in the docs

0

This script:

aws sqs send-message --queue-url "$1" --message-body "body"
RECEIPT_HANDLE=$(aws sqs receive-message --queue-url "$1" --visibility-timeout 300 | jq -r .Messages[0].ReceiptHandle)
aws sqs delete-message --queue-url "$1" --receipt-handle "$RECEIPT_HANDLE"
aws sqs change-message-visibility --queue-url "$1" --receipt-handle "$RECEIPT_HANDLE" --visibility-timeout "10"

results in the following error:

An error occurred (InvalidParameterValue) when calling the ChangeMessageVisibility operation: Value <receipt handle value here> for parameter ReceiptHandle is invalid. Reason: Message does not exist or is not available for visibility timeout change.

The InvalidParameterValue error code isn't mentioned anywhere on this page, however: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ChangeMessageVisibility.html

Why is that?

Here's my AWS CLI version: aws-cli/2.7.4 Python/3.9.11 Darwin/22.3.0 exe/x86_64 prompt/off

已提問 1 年前檢視次數 695 次
1 個回答
0

Due to encapsulation in the CLI code I'd expect. The CLI is written in Python and the Python SDK (Boto3) does have a specific exception for the error you're hitting - ReceiptHandleIsInvalid in the API, SQS.Client.exceptions.ReceiptHandleIsInvalid in the SDK. It looks like the CLI code for convenience would trap this exception and re-raise as a more generic InvalidParameterValue exception, with its description reflecting the original specific error.

專家
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南