From ea545aeed05287371224480f574c038b2c820d1d Mon Sep 17 00:00:00 2001 From: MasterPtato Date: Mon, 6 Apr 2026 17:46:03 -0700 Subject: [PATCH] fix: remove serverless token --- engine/packages/pegboard-outbound/src/lib.rs | 13 ------------- .../envoy-client/src/tasks/envoy/index.ts | 17 ++--------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/engine/packages/pegboard-outbound/src/lib.rs b/engine/packages/pegboard-outbound/src/lib.rs index d2dfb2ae6e..f8932fadc0 100644 --- a/engine/packages/pegboard-outbound/src/lib.rs +++ b/engine/packages/pegboard-outbound/src/lib.rs @@ -17,7 +17,6 @@ use vbare::OwnedVersionedData; mod metrics; const X_RIVET_ENDPOINT: HeaderName = HeaderName::from_static("x-rivet-endpoint"); -const X_RIVET_TOKEN: HeaderName = HeaderName::from_static("x-rivet-token"); const X_RIVET_POOL_NAME: HeaderName = HeaderName::from_static("x-rivet-pool-name"); const X_RIVET_NAMESPACE_NAME: HeaderName = HeaderName::from_static("x-rivet-namespace-name"); const SHUTDOWN_PROGRESS_INTERVAL: Duration = Duration::from_secs(7); @@ -249,10 +248,6 @@ async fn handle(ctx: &StandaloneCtx, packet: protocol::ToOutbound) -> Result<()> &url, headers, request_lifespan, - ctx.config() - .auth - .as_ref() - .map(|a| a.admin_token.read().as_str()), ) .await; @@ -275,17 +270,10 @@ async fn serverless_outbound_req( url: &str, headers: HashMap, request_lifespan: u32, - token: Option<&str>, ) -> Result<()> { let current_dc = ctx.config().topology().current_dc()?; let mut term_signal = TermSignal::get(); - let token = if let Some(token) = token { - Some((X_RIVET_TOKEN, HeaderValue::try_from(token)?)) - } else { - None - }; - let headers = headers .into_iter() .flat_map(|(k, v)| { @@ -306,7 +294,6 @@ async fn serverless_outbound_req( HeaderValue::try_from(namespace_name)?, ), ]) - .chain(token) .collect(); let endpoint_url = format!("{}/start", url.trim_end_matches('/')); diff --git a/engine/sdks/typescript/envoy-client/src/tasks/envoy/index.ts b/engine/sdks/typescript/envoy-client/src/tasks/envoy/index.ts index b11e18f94a..a93ad57a62 100644 --- a/engine/sdks/typescript/envoy-client/src/tasks/envoy/index.ts +++ b/engine/sdks/typescript/envoy-client/src/tasks/envoy/index.ts @@ -33,7 +33,6 @@ import { BufferMap, EnvoyShutdownError } from "@/utils.js"; import { stringifyToEnvoy } from "@/stringify.js"; let GLOBAL_ENVOY: EnvoyHandle | undefined = undefined; -let GLOBAL_SHARED_CTX: SharedContext | undefined = undefined; export interface EnvoyContext { shared: SharedContext; @@ -97,14 +96,7 @@ export async function startEnvoy(config: EnvoyConfig): Promise { // Must manually wait for envoy to start. export function startEnvoySync(config: EnvoyConfig): EnvoyHandle { - if (!config.notGlobal && GLOBAL_ENVOY && GLOBAL_SHARED_CTX) { - // Copy the token when called multiple times. This is done for serverless envoys where the token - // normally expires around the same time as the /start request expires. The envoy persists longer - // than the /start request so it needs an up to date token. - GLOBAL_SHARED_CTX.config.token = config.token; - - return GLOBAL_ENVOY; - } + if (!config.notGlobal && GLOBAL_ENVOY) return GLOBAL_ENVOY; const [envoyTx, envoyRx] = unboundedChannel(); const [startTx, startRx] = watch(void 0); @@ -118,8 +110,6 @@ export function startEnvoySync(config: EnvoyConfig): EnvoyHandle { handle: null as any, }; - if (!config.notGlobal) GLOBAL_SHARED_CTX = shared; - startConnection(shared); const ctx: EnvoyContext = { @@ -201,10 +191,7 @@ export function startEnvoySync(config: EnvoyConfig): EnvoyHandle { msg: "envoy stopped", }); - if (!ctx.shared.config.notGlobal) { - GLOBAL_ENVOY = undefined; - GLOBAL_SHARED_CTX = undefined; - } + if (!ctx.shared.config.notGlobal) GLOBAL_ENVOY = undefined; ctx.shared.config.onShutdown(); });