Skip to content

Commit 5082a7d

Browse files
committed
fix(webhooks): handle auth not found error to prevent webhook retries
1 parent 4bd5b18 commit 5082a7d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

functions/routes/ecom/webhook.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ exports.post = ({ appSdk }, req, res) => {
4040
if (err.name === SKIP_TRIGGER_NAME) {
4141
// trigger ignored by app configuration
4242
res.send(ECHO_SKIP)
43+
} else if (err.appWithoutAuth === true) {
44+
const msg = `Webhook for ${storeId} unhandled with no authentication found`
45+
const error = new Error(msg)
46+
error.trigger = JSON.stringify(trigger)
47+
console.error(error)
48+
res.status(412).send(msg)
4349
} else {
4450
// console.error(err)
4551
// request to Store API with error response

0 commit comments

Comments
 (0)