From 62e1f8196bcf5a76bbe2bc3dfce0e605fc5be2e0 Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Mon, 28 Feb 2022 20:03:02 +0000 Subject: [PATCH] Fixing an issue with webhook controller. --- packages/server/src/api/controllers/webhook.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/webhook.js b/packages/server/src/api/controllers/webhook.js index 9958560e43..67427e5710 100644 --- a/packages/server/src/api/controllers/webhook.js +++ b/packages/server/src/api/controllers/webhook.js @@ -1,6 +1,7 @@ const { generateWebhookID, getWebhookParams } = require("../../db/utils") const toJsonSchema = require("to-json-schema") const validate = require("jsonschema").validate +const { WebhookType } = require("../../constants") const triggers = require("../../automations/triggers") const { getProdAppID } = require("@budibase/backend-core/db") const { getAppDB, updateAppId } = require("@budibase/backend-core/context") @@ -58,7 +59,7 @@ exports.buildSchema = async ctx => { const webhook = await db.get(ctx.params.id) webhook.bodySchema = toJsonSchema(ctx.request.body) // update the automation outputs - if (webhook.action.type === exports.WebhookType.AUTOMATION) { + if (webhook.action.type === WebhookType.AUTOMATION) { let automation = await db.get(webhook.action.target) const autoOutputs = automation.definition.trigger.schema.outputs let properties = webhook.bodySchema.properties @@ -88,7 +89,7 @@ exports.trigger = async ctx => { validate(ctx.request.body, webhook.bodySchema) } const target = await db.get(webhook.action.target) - if (webhook.action.type === exports.WebhookType.AUTOMATION) { + if (webhook.action.type === WebhookType.AUTOMATION) { // trigger with both the pure request and then expand it // incase the user has produced a schema to bind to await triggers.externalTrigger(target, {