Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscriptions: Message HTTP body is missing various fields #57

Open
TheJosh opened this issue Jul 22, 2020 · 0 comments
Open

Subscriptions: Message HTTP body is missing various fields #57

TheJosh opened this issue Jul 22, 2020 · 0 comments

Comments

@TheJosh
Copy link

TheJosh commented Jul 22, 2020

The JSON body contains some fields such as MessageId, Message, and Type, but other fields are missing.

The PHP SNS SDK requires all of these fields [1] and throws an exception if any are missing:

  • Message
  • MessageId
  • Timestamp
  • TopicArn
  • Type
  • Signature
  • SigningCertURL or SigningCertUrl
  • SignatureVersion

In my implementation I'm already skipping signing for non-production (my other sns testing tools don't sign the requests) but the fields would still need to exist for the Message object to be constructed, such as via Message::fromRawPostData method.

In my "manually trigger sns handler" testing code code, I'm using the following field values:

Field Value
MessageId guid
Signature EXAMPLE
SignatureVersion 1
SigningCertURL http://example.com
Timestamp current unix time, i.e. php gmdate('c')
TopicArn arn:aws:sns:us-west-2:123456789012:MyTopic but the actual topic would be better
Type Notification

I think I can see how to patch these other fields in, so I might have a go at it myself.

[1] https://github.com/aws/aws-php-sns-message-validator/blob/master/src/Message.php#L11

@TheJosh TheJosh changed the title HTTP body missing various fields Subscriptions: Message HTTP body is missing various fields Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant