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개 답변
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.

전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인