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

EXPERTO
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas