[RFC] Webhooks #13
fredericbarthelet
started this conversation in
Constructs
Replies: 1 comment 1 reply
-
@fredericbarthelet I really like the implementation choice you've made for lift's webhook construct. And I wish I could use it in my usecase. This construct won't work with Stripe webhook though, therefore the example config you've written are kinda misleading:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The goal of this discussion is to get feedback on the "Webhooks" component.
If you are new to Lift, a quick intro: it's a Serverless plugin that can be installed via npm and enabled in any serverless.yml file.
Here is what we are planning so far.
Use case
Receive event notifications with HTTP webhooks
Every application needs to interact with an ecosystem of 3rd party SaaS providers.
Implementing a webhook HTTP endpoint in your application allows this ecosystem of external applications to notify you. Your application can then react to those notifications and perform tasks accordingly.
Quick start
How it works
The webhook component deploys the following resources:
PutEvents
API of Eventbridge (reused for all webhooks defined in the service file)Lambda (or any other service) consumers
Another way to look at it is to provide the full experience and allow user definition of consumer directly within the component.
Such implementation removes the need to reference the component (as shown below). It also allows the setup of an additional security layer of DLQ on each consumer (to ensure no message are lost) and a retry policy (that the user may not implement if he defines himself the consumers with all options of the Serverless Framework).
WDYT ?
References
The component will introduce
${webhooks:xxx}
variables to easily reference queues in serverless.yml, without using CloudFormation.For example:
Configuration reference
Path (required)
The endpoint your webhook should be exposed on. Always starts with a
/
.The final URL for the webhook endpoint will be displayed in the information section when running a
serverless deploy
command and will bePOST https://{id}.execute-api.{region}.amazonaws.com{path}
Authorizer (required)
The Lambda "stripe-authorizer" function is configured inside the webhook, instead of being defined in the
functions
section.The only required value is the
handler
: this should point to the code that authenticate 3rd party notification. The handler will receive an event from API Gateway using payload format v2. The handler should be written to return a boolean.All settings allowed for functions can be used under the
authorizer
key. For example:Lift will automatically configure the function to be triggered by API Gateway. It is not necessary to define
events
on the function.Type (optional)
Defaults to
Webhook
.Can either be a dynamic path selector:
Or a static string:
Always favor dynamic path selector to ensure the minimum amount of compute is executed downstream. The list of available dynamic selector is available in API Gateway documentation.
Additional functionalities
Alarm
Alarm can be implemented for 2 situations:
4xx
errors on the HTTP endpoint (bad signature check of Denial of Wallet attempt)Beta Was this translation helpful? Give feedback.
All reactions