From be09410cae656abf893b5f89510fa839720a7c4c Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 1 Oct 2021 13:29:08 +0100 Subject: [PATCH] Quick fix for worker, API key was not considered good enough to access worker, updated this and added better error to smtp action. --- packages/server/src/utilities/workerRequests.js | 3 ++- packages/worker/src/api/index.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/server/src/utilities/workerRequests.js b/packages/server/src/utilities/workerRequests.js index 2ace265ca0..88771ef006 100644 --- a/packages/server/src/utilities/workerRequests.js +++ b/packages/server/src/utilities/workerRequests.js @@ -52,7 +52,8 @@ exports.sendSmtpEmail = async (to, from, subject, contents, automation) => { ) if (response.status !== 200) { - throw "Unable to send email." + const error = await response.text() + throw `Unable to send email - ${error}` } return response.json() } diff --git a/packages/worker/src/api/index.js b/packages/worker/src/api/index.js index e3cc6efbc4..3ed6a96ac1 100644 --- a/packages/worker/src/api/index.js +++ b/packages/worker/src/api/index.js @@ -87,7 +87,7 @@ router if (ctx.publicEndpoint) { return next() } - if (!ctx.isAuthenticated || !ctx.user.budibaseAccess) { + if ((!ctx.isAuthenticated || !ctx.user.budibaseAccess) && !ctx.internal) { ctx.throw(403, "Unauthorized - no public worker access") } return next()