Aws-cli: AWS CLI retrieves HTML from an URL and puts it into the message body instead of just the URL. (SQS)

Created on 2 May 2017  路  8Comments  路  Source: aws/aws-cli

Hello,

I found an interesting feature/bug which is not in the documentation of aws cli.
I use "aws sqs send-message" to put a message into the queue, but the message body is an URL. Usually I would do that through python/node whatever, but for this specific situation I use bash, and of course aws cli. But as I stated, the message body consists of an URL (let's say http://www.bbc.com)
normally that would be the exact message, but aws cli chooses to retrieve the HTML from that URL.

To me it bothers me a lot, because of existing lambda functions that need to be changed, before they can work with the modified version (putting the url between '"' solves the problem).

Test command: aws sqs send-message --queue-url QUEUE URL HERE --message-body "http://www.bbc.com"

Any one who can enlighten me in this particular situation?

Best regards

feature-request paramfile

Most helpful comment

This workaround works for me:

aws sqs send-message ... --cli-input-json '{"MessageBody": "https://www.google.com"}'

All 8 comments

Confirmed I could reproduce this issue, using the AWS CLI versus the AWS Console and sending the same payload (a URL) would produce different results, the AWS CLI actually dumping HTML. This behaviour seems undocumented and perhaps unintended?

So the reason you are seeing this is because it is a feature of the CLI that if a value starts with: http:// or https:// it will actually grab the contents for you and use the contents as the value it sends to the API.

Unfortunately, there is no explicit option for turning this off. The best way to get around this would be to use --cli-input-json parameter and provide all of the parameters in a single file or to save the contents of the message in a file and provide the file to the --message parameter using the file:// prefix.

Let us know if that helps of if you have anymore questions.

Thank you for your response,

At first I would advise to add this to the documentation. This had me stressed out for a bit.
Second, maybe put the flag to disable the HTML grabbing on the TODO list?

I agree on both points. I think a flag to disable automatic remote/local content grabbing would be nice because currently there is no great workaround. Marking as feature request.

This workaround works for me:

aws sqs send-message ... --cli-input-json '{"MessageBody": "https://www.google.com"}'

Good Morning!

We're closing this issue here on GitHub, as part of our migration to UserVoice for feature requests involving the AWS CLI.

This will let us get the most important features to you, by making it easier to search for and show support for the features you care the most about, without diluting the conversation with bug reports.

As a quick UserVoice primer (if not already familiar): after an idea is posted, people can vote on the ideas, and the product team will be responding directly to the most popular suggestions.

We鈥檝e imported existing feature requests from GitHub - Search for this issue there!

And don't worry, this issue will still exist on GitHub for posterity's sake. As it鈥檚 a text-only import of the original post into UserVoice, we鈥檒l still be keeping in mind the comments and discussion that already exist here on the GitHub issue.

GitHub will remain the channel for reporting bugs.

Once again, this issue can now be found by searching for the title on: https://aws.uservoice.com/forums/598381-aws-command-line-interface

-The AWS SDKs & Tools Team

Based on community feedback, we have decided to return feature requests to GitHub issues.

Closing due to #3398

Was this page helpful?
0 / 5 - 0 ratings