1
0
Fork 0
mirror of synced 2024-07-02 21:10:43 +12:00

Merge pull request #1126 from Budibase/bug/zapier-auto-fix

Some deployed automation bug fixes
This commit is contained in:
Michael Drury 2021-02-17 14:10:42 +00:00 committed by GitHub
commit f67a4bcd78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

View file

@ -14,7 +14,6 @@ exports.fetchInfo = async ctx => {
} }
exports.save = async ctx => { exports.save = async ctx => {
console.trace("DID A SAVE!")
const db = new CouchDB(BUILDER_CONFIG_DB) const db = new CouchDB(BUILDER_CONFIG_DB)
const { type } = ctx.request.body const { type } = ctx.request.body
if (type === HostingTypes.CLOUD && ctx.request.body._rev) { if (type === HostingTypes.CLOUD && ctx.request.body._rev) {

View file

@ -53,6 +53,10 @@ module.exports.getAction = async function(actionName) {
if (BUILTIN_ACTIONS[actionName] != null) { if (BUILTIN_ACTIONS[actionName] != null) {
return BUILTIN_ACTIONS[actionName] return BUILTIN_ACTIONS[actionName]
} }
// worker pools means that a worker may not have manifest
if (env.CLOUD && MANIFEST == null) {
MANIFEST = await module.exports.init()
}
// env setup to get async packages // env setup to get async packages
if (!MANIFEST || !MANIFEST.packages || !MANIFEST.packages[actionName]) { if (!MANIFEST || !MANIFEST.packages || !MANIFEST.packages[actionName]) {
return null return null
@ -86,8 +90,10 @@ module.exports.init = async function() {
? Object.assign(MANIFEST.packages, BUILTIN_DEFINITIONS) ? Object.assign(MANIFEST.packages, BUILTIN_DEFINITIONS)
: BUILTIN_DEFINITIONS : BUILTIN_DEFINITIONS
} catch (err) { } catch (err) {
console.error(err)
Sentry.captureException(err) Sentry.captureException(err)
} }
return MANIFEST
} }
module.exports.DEFINITIONS = BUILTIN_DEFINITIONS module.exports.DEFINITIONS = BUILTIN_DEFINITIONS

View file

@ -34,7 +34,7 @@ module.exports.init = function() {
actions.init().then(() => { actions.init().then(() => {
triggers.automationQueue.process(async job => { triggers.automationQueue.process(async job => {
try { try {
if (env.CLOUD && job.data.automation) { if (env.CLOUD && job.data.automation && !env.SELF_HOSTED) {
job.data.automation.apiKey = await updateQuota(job.data.automation) job.data.automation.apiKey = await updateQuota(job.data.automation)
} }
if (env.BUDIBASE_ENVIRONMENT === "PRODUCTION") { if (env.BUDIBASE_ENVIRONMENT === "PRODUCTION") {

View file

@ -50,6 +50,9 @@ exports.Properties = {
} }
exports.getAPIKey = async appId => { exports.getAPIKey = async appId => {
if (env.SELF_HOSTED) {
return { apiKey: null }
}
return apiKeyTable.get({ primary: appId }) return apiKeyTable.get({ primary: appId })
} }
@ -63,7 +66,7 @@ exports.getAPIKey = async appId => {
*/ */
exports.update = async (apiKey, property, usage) => { exports.update = async (apiKey, property, usage) => {
// don't try validate in builder // don't try validate in builder
if (!env.CLOUD) { if (!env.CLOUD || env.SELF_HOSTED) {
return return
} }
try { try {