From 9daccff34bd9a6e706b203620918552617877e47 Mon Sep 17 00:00:00 2001 From: Warren <5959690+wrn14897@users.noreply.github.com> Date: Fri, 10 Jan 2025 14:22:26 -0800 Subject: [PATCH] fix: should check team + service + name instead (adding webhook) (#550) --- .changeset/tricky-actors-judge.md | 5 +++++ packages/api/src/routers/api/webhooks.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/tricky-actors-judge.md diff --git a/.changeset/tricky-actors-judge.md b/.changeset/tricky-actors-judge.md new file mode 100644 index 000000000..742c364c5 --- /dev/null +++ b/.changeset/tricky-actors-judge.md @@ -0,0 +1,5 @@ +--- +"@hyperdx/api": patch +--- + +fix: should check team + service + name uniq constraint instead (adding webhook) diff --git a/packages/api/src/routers/api/webhooks.ts b/packages/api/src/routers/api/webhooks.ts index 773fa77df..a2bb4a7b0 100644 --- a/packages/api/src/routers/api/webhooks.ts +++ b/packages/api/src/routers/api/webhooks.ts @@ -58,7 +58,7 @@ router.post( } const { name, service, url, description, queryParams, headers, body } = req.body; - if (await Webhook.findOne({ team: teamId, service, url })) { + if (await Webhook.findOne({ team: teamId, service, name })) { return res.status(400).json({ message: 'Webhook already exists', });