pplu / aws-sdk-perl

A community AWS SDK for Perl Programmers
Other
171 stars 94 forks source link

Paws::SQS::TagQueue fails with 'Start of list found where not expected' #381

Open edencrane opened 4 years ago

edencrane commented 4 years ago

https://metacpan.org/pod/Paws::SQS::TagQueue says:

my $sqs = Paws->service('SQS');
$sqs->TagQueue(
  QueueUrl => 'MyString',
  Tags     => { 'MyTagKey' => 'MyTagValue', },

);

But this program fails:

use strict;
use warnings;
use Paws;

# Environment defines AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION
foreach (qw/AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_DEFAULT_REGION/) {
    die("Required environment variable $_ definition missing") if (($ENV{$_} // '') eq '');
}

my $sqs = Paws->service('SQS', 'region' => $ENV{'AWS_DEFAULT_REGION'});
my $create_queue_result = $sqs->CreateQueue('QueueName' => "test_queue");
my $queue_url = $create_queue_result->QueueUrl();

# All's well up to this point; queue is created

$sqs->TagQueue(
    'QueueUrl'  => $queue_url,
    'Tags'      => {'test_tag' => 'abc'},
)
Start of list found where not expected
`Trace begun at /opt/perl5/lib/site_perl/5.30.0/Paws/Net/XMLResponse.pm line 46
Paws::Net::XMLResponse::process('Paws::Net::XMLResponse=HASH(0x2a21178)', 'Paws::SQS::TagQueue=HASH(0x3456d38)', 'Paws::Net::APIResponse=HASH(0x3480da8)') called at /opt/perl5/lib/site_perl/5.30.0/Paws/Net/Caller.pm line 46
Paws::Net::Caller::caller_to_response('Paws::Net::Caller=HASH(0x1a20550)', 'Paws::SQS=HASH(0x25bd690)', 'Paws::SQS::TagQueue=HASH(0x3456d38)', 'Paws::Net::APIResponse=HASH(0x3480da8)') called at /opt/perl5/lib/site_perl/5.30.0/Paws/Net/RetryCallerRole.pm line 19
Paws::Net::RetryCallerRole::do_call('Paws::Net::Caller=HASH(0x1a20550)', 'Paws::SQS=HASH(0x25bd690)', 'Paws::SQS::TagQueue=HASH(0x3456d38)') called at /opt/perl5/lib/site_perl/5.30.0/Paws/SQS.pm line 149
Paws::SQS::TagQueue('Paws::SQS=HASH(0x25bd690)', 'QueueUrl', 'https://us-west-2.queue.amazonaws.com/<REDACTED_ACCOUNT_NUMBER>/test_queue', 'Tags', 'HASH(0x2c02080)') called at paws_sqs line 22

The same failure occurs if just 'test_queue' is passed instead of the full $queue_url. Is this interface misdocumented? Am I missing something obvious here?

(Reporting here for a colleague, per https://stackoverflow.com/questions/60357549/pawssqstagqueue-fails-with-start-of-list-found-where-not-expected)

byterock commented 4 years ago

Most likely it is just never worked. I do not see a test for 'TagQueue' in the 'aws-sdk-perl/t' I have spent a good deal of time cleaning up the 'RestXml' pm will see if I can find a little time for this one.

If you want to see more details on what is going one you will have to hack 'Paws::Net::XMLResponse' pm a little by adding this in;

sub unserializeresponse { my ($self, $response) = @; ++ use Data::Dumper; ++ warn("unserialize_response response=".Dumper($response));

castaway commented 4 years ago

As we've fixed many XML service things (but not quite released them, working on it!), it's probably best to retest it against the test/stabilisation / S3objecttagging branches first.