Skip to content

Commit

Permalink
tighten init
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtruong committed Oct 21, 2024
1 parent fe13989 commit 6ed5813
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions sdks/node/src/clientApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ export async function init({
host = 'https://api.wandb.ai',
apiKey = getApiKey(),
}: InitOptions): Promise<WeaveClient> {
const headers: Record<string, string> = {
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({
Expand All @@ -51,9 +50,7 @@ export async function init({

const traceServerApi = new TraceServerApi({
baseUrl: 'https://trace.wandb.ai',
baseApiParams: {
headers: headers,
},
baseApiParams: { headers },
customFetch: concurrencyLimitedFetch,
});

Expand Down

0 comments on commit 6ed5813

Please sign in to comment.