Giter Club home page Giter Club logo

amazonsns-php-api's Issues

Why does function subscribe returns true?

Upon unsubscribe, you need the subscriptionArn which is returned by AmazonSNS upon subscribe. If you return true, the subscriptionArn cannot be saved and thus the Endpoint cannot be unsubscribed afterwards

Hardcoded endpoints

I've been using this library for a while. But I now have the requirement to connect to a Dockerised local version of SNS (rather than the real live AWS service).

Obviously, it's impossible with this library because the endpoints are derived from the region in the constructor. I'm currently working on adapting this library so the constructor will look like this:

public function __construct(string $accessKey, string $secretKey, string $endpoint) {

I will then provide a factory method to construct the client using a region:

public static function fromAwsCredentials(string $accessKey, string $secretKey, string $region): AmazonSNS {

This method would then encapsulate the logic of converting the region into an endpoint. I'd probably also inject the functionality of converting the region into an endpoint using a RegionHandler class or something so that users can create their own providers (for handling new regions or whatever).

Obviously this is making a breaking change and is almost become another library altogether. But I will keep your _request method and all the API methods themselves intact.

So my question is, do you want me to do a PR for all of this? And make it a new major version? Or would you rather I just created my own GitHub/Packagist for this and go our separate ways?

There was a problem executing this request

I have a progrma in the format of this and I am getting this error There was a problem executing this request. Could you halp me understand the problem.

// Create an instance
$AmazonSNS = new AmazonSNS('key', 'key');
$AmazonSNS->setRegion('us-east-1');

// And send a message to subscribers of this topic
$AmazonSNS->publish(topicarn', $message);

Problem with http_build_query

Not sure why, but on one of our servers http_build_query() function was separating URL parameters with &amps; instead of &.

Changing line to this solved the issue.
$request = $this->protocol . $this->endpoint . '/?' . http_build_query($params,'','&');

Second issue I found was that the Timestamp should include milliseconds:
$params['Timestamp'] = gmdate('Y-m-d\TH:i:s.000\Z');

Otherwhise great class. I love these simple single purpose classes instead of large SDKs.

Fatal error: Uncaught exception 'APIException' with message 'There was a problem executing this request'

Run your sample code, got this error:

Fatal error: Uncaught exception 'APIException' with message 'There was a problem executing this request' in /Applications/XAMPP/xamppfiles/htdocs/dummyserver/vendor/chrisbarr/amazon-sns-php-api/lib/AmazonSNS.php:567 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/dummyserver/vendor/chrisbarr/amazon-sns-php-api/lib/AmazonSNS.php(177): AmazonSNS->_request('CreateTopic', Array) #1 /Applications/XAMPP/xamppfiles/htdocs/dummyserver/server1/sns.php(9): AmazonSNS->createTopic('My New SNS Topi...') #2 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/dummyserver/vendor/chrisbarr/amazon-sns-php-api/lib/AmazonSNS.php on line 567

listSubscriptions() or listSubscriptionsByTopic() do not work with the returned NextToken from previous call

  1. the NextToken does not get returned by these functions, a bit hard if you want your next request to pass the returned NextToken param, so might be better to return it ;)
if(isset($resultXml->ListSubscriptionsResult->NextToken)) {
    $return->nexttoken = $resultXml->ListSubscriptionsResult->NextToken;
}
$return->members = $this->_processXmlToArray($subs);
return $return;
  1. Even when you change the return of these functions and use the returned NextToken to pass into the next call, AWS returns error: "SNS returned the error "SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details." and code 403".

Something goes wrong in the Signature creation... Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.