From 3e848818f96e9e0da99044cdbee118629b602519 Mon Sep 17 00:00:00 2001 From: Michael Doyle Date: Tue, 18 Feb 2025 23:28:46 -0500 Subject: [PATCH] fix(js/plugins/google-cloud): pass projectId through to GoogleAuth client --- js/plugins/google-cloud/src/gcpLogger.ts | 2 +- js/plugins/google-cloud/src/gcpOpenTelemetry.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/js/plugins/google-cloud/src/gcpLogger.ts b/js/plugins/google-cloud/src/gcpLogger.ts index ff95b821b..2684772ea 100644 --- a/js/plugins/google-cloud/src/gcpLogger.ts +++ b/js/plugins/google-cloud/src/gcpLogger.ts @@ -55,10 +55,10 @@ export class GcpLogger { transports.push( this.shouldExport(env) ? new LoggingWinston({ - projectId: this.config.projectId, labels: { module: 'genkit' }, prefix: 'genkit', logName: 'genkit_log', + projectId: this.config.projectId, credentials: this.config.credentials, autoRetry: true, defaultCallback: await this.getErrorHandler(), diff --git a/js/plugins/google-cloud/src/gcpOpenTelemetry.ts b/js/plugins/google-cloud/src/gcpOpenTelemetry.ts index 5b641fbda..b663ca73e 100644 --- a/js/plugins/google-cloud/src/gcpOpenTelemetry.ts +++ b/js/plugins/google-cloud/src/gcpOpenTelemetry.ts @@ -123,8 +123,9 @@ export class GcpOpenTelemetry { spanExporter = new AdjustingTraceExporter( this.shouldExportTraces() ? new TraceExporter({ - // Creds for non-GCP environments; otherwise credentials will be - // automatically detected via ADC + // provided projectId should take precedence over env vars, etc + projectId: this.config.projectId, + // creds for non-GCP environments, in lieu of using ADC. credentials: this.config.credentials, }) : new InMemorySpanExporter(), @@ -186,8 +187,9 @@ export class GcpOpenTelemetry { product: 'genkit', version: GENKIT_VERSION, }, - // Creds for non-GCP environments; otherwise credentials will be - // automatically detected via ADC + // provided projectId should take precedence over env vars, etc + projectId: this.config.projectId, + // creds for non-GCP environments, in lieu of using ADC. credentials: this.config.credentials, }, getErrorHandler(