Skip to content

Commit

Permalink
fix: release sandbox and auth prop validation
Browse files Browse the repository at this point in the history
  • Loading branch information
abuaboud committed Jan 4, 2024
1 parent 2d1b7e6 commit ab48eee
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-cloud-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
Release:
env:
MY_VERSION: appsumo2
MY_VERSION: appsumo3
runs-on: ubuntu-latest
steps:
- name: Check out repository code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,11 @@ async function validateAction({ projectId, settings }: { projectId: ProjectId, s
if (isNil(action)) {
return false
}
return validateProps(action.props, settings.input)
const props = action.props
if (!isNil(piece.auth)) {
props.auth = piece.auth
}
return validateProps(props, settings.input)
}

async function validateTrigger({ settings, projectId }: { settings: PieceTriggerSettings, projectId: ProjectId }): Promise<boolean> {
Expand All @@ -388,7 +392,11 @@ async function validateTrigger({ settings, projectId }: { settings: PieceTrigger
if (isNil(trigger)) {
return false
}
return validateProps(trigger.props, settings.input)
const props = trigger.props
if (!isNil(piece.auth)) {
props.auth = piece.auth
}
return validateProps(props, settings.input)
}

function validateProps(props: PiecePropertyMap, input: Record<string, unknown>): boolean {
Expand Down
33 changes: 9 additions & 24 deletions packages/backend/src/app/workers/flow-worker/flow-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,29 +158,13 @@ const loadInputAndLogFileId = async ({
}
}
case ExecutionType.BEGIN:
default: {
if (!isNil(flowRun.logsFileId)) {
const logFile = await fileService.getOneOrThrow({
fileId: flowRun.logsFileId,
projectId: jobData.projectId,
})

const serializedExecutionOutput = logFile.data.toString('utf-8')
const executionOutput: ExecutionOutput = JSON.parse(
serializedExecutionOutput,
)

jobData.payload = executionOutput.executionState.steps.trigger.output
}

return {
input: {
triggerPayload: jobData.payload,
executionType: ExecutionType.BEGIN,
...baseInput,
},
}
}
}
}

Expand All @@ -205,21 +189,22 @@ async function executeFlow(jobData: OneTimeJobData): Promise<void> {

await flowWorkerHooks.getHooks().preExecute({ projectId: jobData.projectId, runId: jobData.runId })

const sandbox = await getSandbox({
projectId: jobData.projectId,
flowVersion,
runEnvironment: jobData.environment,
})

logger.info(`[FlowWorker#executeFlow] flowRunId=${jobData.runId} sandboxId=${sandbox.boxId} prepareTime=${Date.now() - startTime}ms`)

try {

const { input, logFileId } = await loadInputAndLogFileId({
flowVersion,
jobData,
})

const sandbox = await getSandbox({
projectId: jobData.projectId,
flowVersion,
runEnvironment: jobData.environment,
})

logger.info(`[FlowWorker#executeFlow] flowRunId=${jobData.runId} sandboxId=${sandbox.boxId} prepareTime=${Date.now() - startTime}ms`)

const { result: executionOutput } = await engineHelper.executeFlow(
sandbox,
input,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const demoTemplate: FlowVersionTemplate = {
nextAction: {
name: 'step_2',
type: ActionType.PIECE,
valid: true,
valid: false,
settings: {
input: {
cc: [],
Expand Down Expand Up @@ -69,5 +69,5 @@ export const demoTemplate: FlowVersionTemplate = {
inputUiInfo: {},
},
},
valid: true,
valid: false,
};

0 comments on commit ab48eee

Please sign in to comment.