diff --git a/packages/runtime-secrets/src/trigger-env.test.ts b/packages/runtime-secrets/src/trigger-env.test.ts index 14432c12dfa..de54bd0fed0 100644 --- a/packages/runtime-secrets/src/trigger-env.test.ts +++ b/packages/runtime-secrets/src/trigger-env.test.ts @@ -1,5 +1,22 @@ import { describe, expect, it } from 'vitest' -import { parseTriggerEnvSyncTargets } from './trigger-env' +import { buildTriggerEnvVars, parseTriggerEnvSyncTargets } from './trigger-env' + +describe('buildTriggerEnvVars', () => { + it('leaves the worker-specific network endpoints to the Trigger.dev environment', () => { + const synced = buildTriggerEnvVars({ + REDIS_URL: 'rediss://vpc-redis:6379', + INTERNAL_API_BASE_URL: 'http://app.internal', + OUTBOUND_GATEWAYS: '{"gw":{"url":"https://vpc-lb:8443"}}', + OUTBOUND_GATEWAY_CREDENTIALS: '{"gw":{"token":"t"}}', + OUTBOUND_ROUTING_SOURCE: 'appconfig', + }).map((v) => v.name) + expect(synced).not.toContain('REDIS_URL') + expect(synced).not.toContain('INTERNAL_API_BASE_URL') + expect(synced).not.toContain('OUTBOUND_GATEWAYS') + expect(synced).toContain('OUTBOUND_GATEWAY_CREDENTIALS') + expect(synced).toContain('OUTBOUND_ROUTING_SOURCE') + }) +}) describe('parseTriggerEnvSyncTargets', () => { it('reads an exact comma list', () => { diff --git a/packages/runtime-secrets/src/trigger-env.ts b/packages/runtime-secrets/src/trigger-env.ts index c85d274b201..7188ca0f583 100644 --- a/packages/runtime-secrets/src/trigger-env.ts +++ b/packages/runtime-secrets/src/trigger-env.ts @@ -26,6 +26,9 @@ const TRIGGER_OWNED_KEYS: ReadonlySet = new Set([ 'REDIS_TLS_SERVERNAME', // A VPC-internal base URL is unreachable from Trigger.dev's cloud. 'INTERNAL_API_BASE_URL', + // The app dials an egress gateway through the VPC load balancer; workers dial it through their + // own endpoint, so each gateway's `url` differs. The credentials and routing source are shared. + 'OUTBOUND_GATEWAYS', // Schema-migration credential: runs never migrate, so they never hold it. 'MIGRATION_DATABASE_URL', // `syncEnvVars` refuses to sync it, so it can only ever be set by hand.