From 6ed5813bd3586d8d24d5a65f2f655dba9cb5c52e Mon Sep 17 00:00:00 2001 From: Andrew Truong Date: Mon, 21 Oct 2024 13:48:14 -0400 Subject: [PATCH] tighten init --- sdks/node/src/clientApi.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sdks/node/src/clientApi.ts b/sdks/node/src/clientApi.ts index 3ce4520ca8..41e31d331b 100644 --- a/sdks/node/src/clientApi.ts +++ b/sdks/node/src/clientApi.ts @@ -22,15 +22,14 @@ export async function init({ host = 'https://api.wandb.ai', apiKey = getApiKey(), }: InitOptions): Promise { - const headers: Record = { + const headers = { 'User-Agent': `W&B Internal JS Client ${process.env.VERSION || 'unknown'}`, Authorization: `Basic ${Buffer.from(`api:${apiKey}`).toString('base64')}`, }; try { const wandbServerApi = new WandbServerApi(host, apiKey); - const defaultEntityName = await wandbServerApi.defaultEntityName(); - const entityName = entity ?? defaultEntityName; + const entityName = entity ?? (await wandbServerApi.defaultEntityName()); const projectId = `${entityName}/${project}`; const retryFetch = createFetchWithRetry({ @@ -51,9 +50,7 @@ export async function init({ const traceServerApi = new TraceServerApi({ baseUrl: 'https://trace.wandb.ai', - baseApiParams: { - headers: headers, - }, + baseApiParams: { headers }, customFetch: concurrencyLimitedFetch, });