Skip to content

fix(js/google-genai): log failed requests at debug level before rethrowing - #13

Closed
genkit-factory-dev[bot] wants to merge 1 commit into
mainfrom
agent/issue-4
Closed

genkit-factory-dev[bot] wants to merge 1 commit into
mainfrom
agent/issue-4

Conversation

@genkit-factory-dev

Copy link
Copy Markdown

Problem

makeRequest in @genkit-ai/google-genai (both Google AI and Vertex AI clients) logs every failed request via logger.error(e) and then rethrows the error. Applications and middleware that catch and log the thrown error emit two ERROR entries with the same stack trace for a single failed request (such as a retryable 429 or 503).

Fix

Replaced logger.error(e) with logger.debug(e) in makeRequest in js/plugins/google-genai/src/googleai/client.ts and js/plugins/google-genai/src/vertexai/client.ts so the error is still available at debug log level while allowing the caller to decide how to handle and log the rethrown error. Added unit tests in both googleai/client_test.ts and vertexai/client_test.ts verifying that failed requests log via logger.debug and do not call logger.error.

Verification

  • pnpm --dir js/plugins/google-genai test (before fix, with new tests): 994 pass, 2 fail
  • pnpm --dir js/plugins/google-genai build: passed
  • pnpm --dir js/plugins/google-genai check: passed
  • pnpm --dir js/plugins/google-genai test (after fix): 996 pass, 0 fail

Triage

  • Severity: P2
  • Size: S

Fixes #4

Accountable: @ssbushi

Opened by the Genkit factory (agy). A human must review and approve before merge.

…owing

Requested-by: Samuel Bushi <ssbushi@google.com>
@genkit-factory-dev genkit-factory-dev Bot added the agent:needs-review AI pipeline: PR ready for review label Oct 21, 2026
@github-actions github-actions Bot added the js label Oct 21, 2026
@ssbushi

ssbushi commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Closing: output of the earlier local pipeline, superseded.

@ssbushi ssbushi closed this Oct 23, 2026
@ssbushi
ssbushi deleted the agent/issue-4 branch October 23, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:needs-review AI pipeline: PR ready for review js

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JS] google-genai plugin logs failed requests at ERROR before rethrowing, so callers log them twice

1 participant