Fixing an issue with automations throwing a Pouch error due to the auth library database not being setup.

This commit is contained in:
mike12345567 2021-12-15 11:25:52 +00:00
parent 846f8b5038
commit ae5b963115
3 changed files with 11 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") const env = require("../environment")
env.setInThread()
const actions = require("../automations/actions") const actions = require("../automations/actions")
const automationUtils = require("../automations/automationUtils") const automationUtils = require("../automations/automationUtils")
const AutomationEmitter = require("../events/AutomationEmitter") const AutomationEmitter = require("../events/AutomationEmitter")

View File

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

View File

@ -0,0 +1,9 @@
const env = require("../environment")
const CouchDB = require("../db")
const { init } = require("@budibase/auth")
exports.threadSetup = () => {
// when thread starts, make sure it is recorded
env.setInThread()
init(CouchDB)
}