Skip to content

Add basic SNS Delivery Policy implementation #87

@timothepearce

Description

@timothepearce

Statement

It seems that SNS has a default delivery policy that is not applied in the plugin.

private publishHttp(event, sub, raw) {
return fetch(sub.Endpoint, {
method: "POST",
body: event,
timeout: 0,
headers: {
"x-amz-sns-rawdelivery": "" + raw,
"Content-Type": "text/plain; charset=UTF-8",
"Content-Length": Buffer.byteLength(event),
},
}).then(res => this.debug(res))
.catch(ex => this.debug(ex));
}

The catched request is only logged, no other behavior is implemented.

Question

Do you think this behavior deserves to be implemented in it?
If so, in what form?

Proposal

I think it would be interesting to keep the current behavior of the plugin and add a custom variable to modify it if necessary.

custom:
  serverless-offline-sns:
    retry: 3 # default 0
    retry-interval: 1000 # In ms, default 0

With a retry custom attribute set to 3 and retry-interval set to 1000, we will send again each initial delivery attempt following the rules of the SNS Delivery Policy.

What do you think about it?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions