Issue: <UnknownOperationException/> while sending to SQS

0

I have created an AWS SQS (Simple Queue Service). This SQS has a permission that allows only a specific user to write to it. The policy has been generated, and the user has been associated with the SQS.

I've configured authentication in Postman, and here's my CURL request:

curl --location '<AWS SQS URL>?X-Amz-Date=20230926T070142Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=<ACCESS-KEY>%2F20230926%2Feu-central-1%2Fsqs%2Faws4_request&X-Amz-SignedHeaders=content-length%3Bcontent-type%3Bhost&X-Amz-Signature=0cd6634bf38588259c4d5ad98b473a59aaf637169ebea1539d5c0000ff146f33' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'messageBody={
	"origin": "solitics",
	"apiKey": "key",
	"customer_id": "75",
	"entity": "ES"
}'

However, I'm receiving only an <UnknownOperationException/> response. What am I doing wrong?

Stefan
asked 7 months ago1407 views
5 Answers
1
Accepted Answer

Also if you must send a message into the queue please use --data-urlencode 'Action=SendMessage'

profile picture
EXPERT
answered 7 months ago
  • Thanks, now its working

1

Hello.

The "<UnknownOperationException/>" error you are encountering typically indicates that AWS SQS is unable to identify the operation you are trying to perform in your request. This could be due to various reasons, and here are some steps you can take to troubleshoot and resolve the issue:

  1. Check the AWS SQS URL: Ensure that you are using the correct URL for your AWS SQS queue. Make sure that the URL is in the correct format and that it points to the correct SQS queue. Verify AWS Signature:

  2. Double-check the AWS signature in your request. It should be correctly generated using the AWS access key, secret key, and other required parameters. Any error in the signature can lead to authentication issues.

  3. Confirm AWS Region: Make sure that you are specifying the correct AWS region in your request. The region should match the region where your SQS queue is located (e.g., "eu-central-1" in your example).

  4. Ensure Correct HTTP Method: Confirm that you are using the correct HTTP method for the SQS API operation you want to perform. AWS SQS primarily uses HTTP POST for sending messages.

  5. Check Message Format: Ensure that the message format you are using in the "messageBody" parameter is valid JSON and follows the expected structure for sending messages to the SQS queue.

  6. Verify Permissions: Double-check the permissions and policies associated with the AWS user you are using in your request. Ensure that the user has the necessary permissions to write messages to the SQS queue.

  7. Error Logs: Check the AWS CloudWatch logs or SQS queue event logs for more detailed error messages that might provide additional information about the issue. Update Curl Request:

Best regards, Andrii

profile picture
EXPERT
answered 7 months ago
  • all things are checked, and I get the same issue as well. I postet my request here, and checked all thing above. I culdn't find any reason why its not working

1

An UnknownOperationException error occurs when a user fails to configure the Content-Type as "application/x-www-form-urlencoded" in the integration request HTTP header. The UnknownOperationException error also occurs when you don't add the SendMessage action to the integration request mapping template. So you can try using 'Content-Type: application/json' instead 'Content-Type: application/x-www-form-urlencoded'

profile picture
EXPERT
answered 7 months ago
  • changed it, and testet it, got the same issue

0

What type of curl request you use "POST" or "GET"?

profile picture
EXPERT
answered 7 months ago
  • In use POST, like its in the documents described

0

Hello, Stefan. Could you please accept the answer if it helps you? Best regards, Andrii

profile picture
EXPERT
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions