Skip to content

Commit 76efee0

Browse files
committed
fix(serverless): overwrite headers instead of appending (#3044)
1 parent 6dd43e9 commit 76efee0

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

packages/core/pegboard-serverless/src/lib.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,26 @@ async fn outbound_handler(
242242
v.parse::<HeaderValue>().ok()?,
243243
))
244244
})
245+
.chain(std::iter::once((
246+
X_RIVETKIT_TOTAL_SLOTS,
247+
HeaderValue::try_from(slots_per_runner)?,
248+
)))
249+
// Add token if auth is enabled
250+
.chain(
251+
ctx.config()
252+
.auth
253+
.as_ref()
254+
.map(|auth| {
255+
anyhow::Ok((
256+
X_RIVET_TOKEN,
257+
HeaderValue::try_from(auth.admin_token.read())?,
258+
))
259+
})
260+
.transpose()?,
261+
)
245262
.collect();
246263

247-
let mut req = client
248-
.get(url)
249-
.headers(headers)
250-
.header(X_RIVETKIT_TOTAL_SLOTS, slots_per_runner.to_string());
251-
252-
// Add admin token if configured
253-
if let Some(auth) = &ctx.config().auth {
254-
req = req.header(X_RIVET_TOKEN, auth.admin_token.read());
255-
}
264+
let mut req = client.get(url).headers(headers);
256265

257266
let mut source = sse::EventSource::new(req).context("failed creating event source")?;
258267
let mut runner_id = None;

packages/services/namespace/src/ops/resolve_for_name_global.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ pub async fn namespace_resolve_for_name_global(
3131
let client = client.clone();
3232
async move {
3333
let url = leader_dc.api_peer_url.join(&format!("/namespaces"))?;
34-
let res = client.get(url).query(&[("name", &input.name)]).send().await?;
34+
let res = client
35+
.get(url)
36+
.query(&[("name", &input.name)])
37+
.send()
38+
.await?;
3539

3640
let res = rivet_api_util::parse_response::<
3741
rivet_api_types::namespaces::list::ListResponse,

0 commit comments

Comments
 (0)