Question

When I try to post a message larger than 65536 bytes using AWSSDK version 2.0.8.2 in C#.

I get the following exception:

An exception of type 'Amazon.SimpleNotificationService.Model.InvalidParameterException' occurred in AWSSDK.dll but was not handled in user code

Additional information: Invalid parameter: Message too long, only requests with signature version 4 can publish messages larger than 65536 bytes.

I've looked everywhere including the AWS docs but I can't find out how to use signature 4 for SNS pushes. Does anyone know?

I've tried updating to 2.0.10.0 but still no luck, here is the code I'm using

RegionEndpoint regionEndPoint = RegionEndpoint.USWest2;

IAmazonSimpleNotificationService snsClient = AWSClientFactory.CreateAmazonSimpleNotificationServiceClient(awsAccessKeyId, awsSecretAccessKey, regionEndPoint);

PublishRequest publishRequest = new PublishRequest()
            {
                Subject = subject,
                Message = jsonBody,
                TopicArn = testTopicArn
            };

            snsClient.Publish(publishRequest);

No correct solution

OTHER TIPS

AWS added support for 256 kb payloads in SQS and SNS on June 18, 2013 as announced in this AWS: "What's new?" post. From the post:

256KB Payloads (SQS and SNS) enable developers to send and receive more data with each API call. Previously, payloads were capped at 64KB. Now, large payloads are billed as one request per 64KB 'chunk' of payload. For example, a single API call for a 256KB payload will be billed as four requests. Our customers tell us larger payloads will enable new use cases that were previously difficult to accomplish.

These features are available today in all regions. In order to use these features, you must use the latest SDK that has AWS Signature Version 4 enabled.

You should only be getting that exception because because you're using an older version of the SDK that only supported 64KB (65,536 bytes) payloads. It seems like the 2.0.8 version of the SDK should have this signing, though. Perhaps check your references in the related project, maybe you have a reference to an older version lingering around that may be causing the issue?

Here's some additional documentation regarding large payloads in SNS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top