Merge pull request #3793 from Budibase/fix/pouch-automation-error

Fix automation TypeError: Pouch is not a constructor
This commit is contained in:
Michael Drury 2021-12-15 15:30:56 +00:00 committed by GitHub
commit a9a7fb0cf4
3 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,5 @@
// when thread starts, make sure it is recorded
require("./utils").threadSetup()
const env = require("../environment")
env.setInThread()
const actions = require("../automations/actions")
const automationUtils = require("../automations/automationUtils")
const AutomationEmitter = require("../events/AutomationEmitter")

View File

@ -1,6 +1,4 @@
// when thread starts, make sure it is recorded
const env = require("../environment")
env.setInThread()
require("./utils").threadSetup()
const ScriptRunner = require("../utilities/scriptRunner")
const { integrations } = require("../integrations")

View File

@ -0,0 +1,13 @@
const env = require("../environment")
const CouchDB = require("../db")
const { init } = require("@budibase/auth")
exports.threadSetup = () => {
// don't run this if not threading
if (env.isTest() || env.DISABLE_THREADING) {
return
}
// when thread starts, make sure it is recorded
env.setInThread()
init(CouchDB)
}