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 Antwort
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.

EXPERTE
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen