Merge pull request #6612 from Budibase/fix/automation-auth-issue
Fix Automation auth issue - External Data Connector not working
This commit is contained in:
commit
02629fcf38
|
@ -166,14 +166,19 @@ export async function preview(ctx: any) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function execute(ctx: any, opts = { rowsOnly: false }) {
|
async function execute(
|
||||||
|
ctx: any,
|
||||||
|
opts: any = { rowsOnly: false, isAutomation: false }
|
||||||
|
) {
|
||||||
const db = getAppDB()
|
const db = getAppDB()
|
||||||
|
|
||||||
const query = await db.get(ctx.params.queryId)
|
const query = await db.get(ctx.params.queryId)
|
||||||
const datasource = await db.get(query.datasourceId)
|
const datasource = await db.get(query.datasourceId)
|
||||||
|
|
||||||
const authConfigCtx: any = getAuthConfig(ctx)
|
let authConfigCtx: any = {}
|
||||||
|
if (!opts.isAutomation) {
|
||||||
|
authConfigCtx = getAuthConfig(ctx)
|
||||||
|
}
|
||||||
const enrichedParameters = ctx.request.body.parameters || {}
|
const enrichedParameters = ctx.request.body.parameters || {}
|
||||||
// make sure parameters are fully enriched with defaults
|
// make sure parameters are fully enriched with defaults
|
||||||
if (query && query.parameters) {
|
if (query && query.parameters) {
|
||||||
|
@ -217,8 +222,11 @@ export async function executeV1(ctx: any) {
|
||||||
return execute(ctx, { rowsOnly: true })
|
return execute(ctx, { rowsOnly: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function executeV2(ctx: any) {
|
export async function executeV2(
|
||||||
return execute(ctx, { rowsOnly: false })
|
ctx: any,
|
||||||
|
{ isAutomation }: { isAutomation?: boolean } = {}
|
||||||
|
) {
|
||||||
|
return execute(ctx, { rowsOnly: false, isAutomation })
|
||||||
}
|
}
|
||||||
|
|
||||||
const removeDynamicVariables = async (queryId: any) => {
|
const removeDynamicVariables = async (queryId: any) => {
|
||||||
|
|
|
@ -72,7 +72,7 @@ exports.run = async function ({ inputs, appId, emitter }) {
|
||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await queryController.executeV2(ctx)
|
await queryController.executeV2(ctx, { isAutomation: true })
|
||||||
const { data, ...rest } = ctx.body
|
const { data, ...rest } = ctx.body
|
||||||
return {
|
return {
|
||||||
response: data,
|
response: data,
|
||||||
|
|
Loading…
Reference in New Issue