Skip to main content

We are trying to migrate an existing custom event transformer to an App with Event Integration and a custom transformer.


The source of the event is an AWS SNS subscription and we are finding that the initial subscription posts are not creating incidents properly.


If just using the default/demo transformer, an incident is created but there is no content in the “detail”, so we see no subscribe link.


If we change the code at all, we stop getting incidents created at all from the SNS subscribe attempt and no errors with debug enabled.


Manual POSTs to the enqueue endpoint using modified code does appear to work, so it’s not clear what is happening to the SNS post.


Logged a support case, but haven’t had a response after almost 2 weeks, so trying the community instead.

After a lot more trial and error, slowly picking apart all the headers that are used by AWS SNS when sending messages (https://docs.aws.amazon.com/sns/latest/dg/sns-message-and-json-formats.html#http-subscription-confirmation-json) I seem to have found the issue. By default an SNS Topic is using the content-type header “Content-Type: text/plain; charset=UTF-8”


From https://docs.aws.amazon.com/sns/latest/dg/sns-message-delivery-retries.html#header-content-type:

image


This seems to be causing problems with how PagerDuty parses the payload in the message (I assume it is expecting a different content-type and so fails to parse the message). If I configure a delivery policy to override the defaults on the SNS Topic so that a content-type header of “Content-Type: application/json”, then the message body/detail looks to be parsed correctly.


I can work around this problem now with the AWS SNS delivery policy, but it would be far more useful if the PagerDuty App Event Transformer processing was able to handle the basic default SNS format (text/plain) in a payload as well as “application/json”. It would help even if it just came through as a raw string rather than nothing.


Also, I would have assumed based on your documentation (https://developer.pagerduty.com/docs/ZG9jOjExNTQzMjMw-writing-app-event-transformers#syntax-errors) and correspondence with previous tech support, that using the “PD.inputRequest.rawBody” property would have returned the raw string, but this


When trying to use the ‘rawBody’ it just comes through as ‘null’ whether the content-type is ‘application/json’ or ‘text/plain’, which doesn’t seem like what should be happening.


Thanks you really. I was suffering from this weird issue and this works like a charm and saved my day indeed. I don’t understand why PagerDuty docs aren’t covering this.


Reply