Bird
0
0

You wrote this code to send a message to an SQS queue but receive an error:

medium📝 Debug Q6 of 15
AWS - SNS and SQS
You wrote this code to send a message to an SQS queue but receive an error:
response = sqs.send_message(QueueUrl=url, MessageBody=12345)

What is the error?
AQueueUrl is missing
Bsend_message requires MessageAttributes parameter
CMessageBody must be a string, not an integer
DMessageBody cannot be empty
Step-by-Step Solution
Solution:
  1. Step 1: Check MessageBody Type Requirement

    MessageBody must be a string. Passing an integer causes a type error.
  2. Step 2: Verify Other Parameters

    QueueUrl is provided; MessageAttributes are optional; MessageBody is not empty but wrong type.
  3. Final Answer:

    MessageBody must be a string, not an integer -> Option C
  4. Quick Check:

    MessageBody type = string required [OK]
Quick Trick: MessageBody must always be a string [OK]
Common Mistakes:
  • Passing numbers instead of strings for MessageBody
  • Assuming MessageAttributes are mandatory
  • Missing QueueUrl parameter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes