Skip to content

Commit c7c391c

Browse files
committed
Bypass proxy for testing against staging
1 parent 1e8edb7 commit c7c391c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/vertexai/src/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export const VERTEX_TYPE = 'vertexAI';
2121

2222
export const DEFAULT_LOCATION = 'us-central1';
2323

24-
export const DEFAULT_BASE_URL = 'https://firebasevertexai.googleapis.com';
24+
export const DEFAULT_BASE_URL = 'staging-aiplatform.sandbox.googleapis.com';
2525

26-
export const DEFAULT_API_VERSION = 'v1beta';
26+
export const DEFAULT_API_VERSION = 'v1beta1';
2727

2828
export const PACKAGE_VERSION = version;
2929

packages/vertexai/src/requests/request.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class RequestUrl {
4545
// TODO: allow user-set option if that feature becomes available
4646
const apiVersion = DEFAULT_API_VERSION;
4747
const baseUrl = this.requestOptions?.baseUrl || DEFAULT_BASE_URL;
48-
let url = `${baseUrl}/${apiVersion}`;
48+
let url = `https://${this.apiSettings.location}-${baseUrl}/${apiVersion}`;
4949
url += `/projects/${this.apiSettings.project}`;
5050
url += `/locations/${this.apiSettings.location}`;
5151
url += `/${this.model}`;
@@ -95,11 +95,11 @@ export async function getHeaders(url: RequestUrl): Promise<Headers> {
9595
}
9696
}
9797

98-
if (url.apiSettings.getAuthToken) {
99-
const authToken = await url.apiSettings.getAuthToken();
100-
if (authToken) {
101-
headers.append('Authorization', `Firebase ${authToken.accessToken}`);
102-
}
98+
const GCLOUD_ACCESS_TOKEN = process.env.GCLOUD_ACCESS_TOKEN;
99+
if (GCLOUD_ACCESS_TOKEN) {
100+
headers.append('Authorization', `Bearer ${GCLOUD_ACCESS_TOKEN}`);
101+
} else {
102+
throw Error("Environment variable GCLOUD_ACCESS_TOKEN is undefined.");
103103
}
104104

105105
return headers;

0 commit comments

Comments
 (0)