Skip to content

Commit ff77546

Browse files
committed
fix(envvars): restore workflowUserId fallback for scheduled execution env var resolution
1 parent b0cb95b commit ff77546

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

apps/sim/lib/workflows/executor/execution-core.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ describe('executeWorkflowCore terminal finalization sequencing', () => {
123123
requestId: 'req-1',
124124
workflowId: 'workflow-1',
125125
userId: 'user-1',
126+
workflowUserId: 'workflow-owner',
126127
workspaceId: 'workspace-1',
127128
triggerType: 'api',
128129
executionId: 'execution-1',

apps/sim/lib/workflows/executor/execution-core.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,13 @@ export async function executeWorkflowCore(
325325

326326
const mergedStates = mergeSubblockStateWithValues(blocks)
327327

328-
const personalEnvUserId = metadata.sessionUserId || metadata.userId
328+
const personalEnvUserId =
329+
metadata.isClientSession && metadata.sessionUserId
330+
? metadata.sessionUserId
331+
: metadata.workflowUserId
329332

330333
if (!personalEnvUserId) {
331-
throw new Error('Missing execution actor for environment resolution')
334+
throw new Error('Missing workflowUserId in execution metadata')
332335
}
333336

334337
const { personalEncrypted, workspaceEncrypted, personalDecrypted, workspaceDecrypted } =

0 commit comments

Comments
 (0)