Skip to content

Subscriptions: Message HTTP body is missing various fields #57

@TheJosh

Description

@TheJosh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions