Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
Add handler for readiness probe
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Oct 28, 2021
1 parent 5243e09 commit 97d369d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ npm run build

| Event | Action | Template |
| -------------------------- | ----------------------------------- | ---------------------- |
| `readiness.probe` | API checking on readiness | - |
| `integrations.create` | Initial setup | - |
| `orders.create` | Send customer receipt | "Order receipt" |
| `orders.physical.shipment` | Send customer shipment notification | "Item shipped" |
Expand Down
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ module.exports = async function handler(request, context) {
// Verify webhook authenticity
verifyWebhook(request.body, context.webhookSigningKey);

// If it's a readiness probe, tell it we're good.
if (request.body.event === 'readiness.probe') {
return {
statusCode: 204,
body: '',
};
}

// Fetch merchant and integration info
const merchant = await context.merchant();
const merchantId = merchant.id;
Expand Down

0 comments on commit 97d369d

Please sign in to comment.