diff --git a/apps/webapp/app/v3/environmentVariables/environmentVariablesRepository.server.ts b/apps/webapp/app/v3/environmentVariables/environmentVariablesRepository.server.ts index b3d5aa852e..975ce231f1 100644 --- a/apps/webapp/app/v3/environmentVariables/environmentVariablesRepository.server.ts +++ b/apps/webapp/app/v3/environmentVariables/environmentVariablesRepository.server.ts @@ -662,12 +662,25 @@ export async function resolveVariablesForEnvironment(runtimeEnvironment: Runtime runtimeEnvironment.id ); + const overridableTriggerVariables = await resolveOverridableTriggerVariables(runtimeEnvironment); + const builtInVariables = runtimeEnvironment.type === "DEVELOPMENT" ? await resolveBuiltInDevVariables(runtimeEnvironment) : await resolveBuiltInProdVariables(runtimeEnvironment); - return [...projectSecrets, ...builtInVariables]; + return [...overridableTriggerVariables, ...projectSecrets, ...builtInVariables]; +} + +async function resolveOverridableTriggerVariables(runtimeEnvironment: RuntimeEnvironment) { + let result: Array = [ + { + key: "TRIGGER_REALTIME_STREAM_VERSION", + value: env.REALTIME_STREAM_VERSION, + }, + ]; + + return result; } async function resolveBuiltInDevVariables(runtimeEnvironment: RuntimeEnvironment) { @@ -684,10 +697,6 @@ async function resolveBuiltInDevVariables(runtimeEnvironment: RuntimeEnvironment key: "TRIGGER_STREAM_URL", value: env.STREAM_ORIGIN ?? env.API_ORIGIN ?? env.APP_ORIGIN, }, - { - key: "TRIGGER_REALTIME_STREAM_VERSION", - value: env.REALTIME_STREAM_VERSION, - }, ]; if (env.DEV_OTEL_BATCH_PROCESSING_ENABLED === "1") { @@ -758,10 +767,6 @@ async function resolveBuiltInProdVariables(runtimeEnvironment: RuntimeEnvironmen key: "TRIGGER_ORG_ID", value: runtimeEnvironment.organizationId, }, - { - key: "TRIGGER_REALTIME_STREAM_VERSION", - value: env.REALTIME_STREAM_VERSION, - }, ]; if (env.PROD_OTEL_BATCH_PROCESSING_ENABLED === "1") { diff --git a/packages/core/src/v3/runMetadata/metadataStream.ts b/packages/core/src/v3/runMetadata/metadataStream.ts index ff32ae3dd2..dfd9965c07 100644 --- a/packages/core/src/v3/runMetadata/metadataStream.ts +++ b/packages/core/src/v3/runMetadata/metadataStream.ts @@ -45,7 +45,6 @@ export class MetadataStream { private initializeServerStream(): Promise { const serverIterator = this.serverIterator; - // TODO: Why is this only sending stuff to the server at the end of the run? const serverStream = new ReadableStream({ async pull(controller) { try {