Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/auth/HeaderAuthProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export class HeaderAuthProvider implements core.AuthProvider {
}

public static canCreate(options: Partial<HeaderAuthProvider.Options>): boolean {
return options?.[PARAM_KEY] != null || process.env?.[ENV_HEADER_KEY] != null;
return options?.[PARAM_KEY] != null || (typeof process !== "undefined" && process.env?.[ENV_HEADER_KEY] != null);
}

public async getAuthRequest({
endpointMetadata,
}: {
endpointMetadata?: core.EndpointMetadata;
} = {}): Promise<core.AuthRequest> {
const headerValue = (await core.Supplier.get(this.options[PARAM_KEY])) ?? process.env?.[ENV_HEADER_KEY];
const headerValue = (await core.Supplier.get(this.options[PARAM_KEY])) ?? (typeof process !== "undefined" ? process.env?.[ENV_HEADER_KEY] : undefined);
if (headerValue == null) {
throw new errors.DeepgramError({
message: HeaderAuthProvider.AUTH_CONFIG_ERROR_MESSAGE,
Expand Down