mercredi 15 avril 2015

Unable to instantiate AWS SDK SNS MessageValidator\Message Class

I'm working through the excellent AWS SNS documentation here (http://ift.tt/PbyqyD) for handling incoming notifications, but am unable to get the following lines to work:



try {
// Create a message from the post data and validate its signature
$message = Message::fromRawPostData();
$validator = new MessageValidator();
$validator->validate($message);
} catch (\Exception $e) {
// Pretend we're not here if the message is invalid
throw new \Exception($e->getMessage());
}


The error message I receive is:



Catchable Fatal Error: Argument 1 passed to Aws\Sns\MessageValidator\Message::fromArray() must be an array, null given



I'm using the correct vendor files and receive that error message with or without the 'vendor/autoload.php' file:



use Aws\Sns\MessageValidator\Message;
use Aws\Sns\MessageValidator\MessageValidator;


Other AWS SDK functions and objects work just fine, including all of the SnsClient functions documented here (http://ift.tt/1b3rA9C), which leads be to believe that the SDK is installed correctly.


Thanks in advance for any help!





Aucun commentaire:

Enregistrer un commentaire