Repository navigation
fix(js/google-genai): log failed requests at debug level before rethrowing - #13
Closed
genkit-factory-dev[bot] wants to merge 1 commit into
Closed
genkit-factory-dev[bot] wants to merge 1 commit into
genkit-factory-dev[bot] wants to merge 1 commit into
Conversation
…owing Requested-by: Samuel Bushi <ssbushi@google.com>
Owner
|
Closing: output of the earlier local pipeline, superseded. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
makeRequestin@genkit-ai/google-genai(both Google AI and Vertex AI clients) logs every failed request vialogger.error(e)and then rethrows the error. Applications and middleware that catch and log the thrown error emit twoERRORentries with the same stack trace for a single failed request (such as a retryable 429 or 503).Fix
Replaced
logger.error(e)withlogger.debug(e)inmakeRequestinjs/plugins/google-genai/src/googleai/client.tsandjs/plugins/google-genai/src/vertexai/client.tsso 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 bothgoogleai/client_test.tsandvertexai/client_test.tsverifying that failed requests log vialogger.debugand do not calllogger.error.Verification
pnpm --dir js/plugins/google-genai test(before fix, with new tests): 994 pass, 2 failpnpm --dir js/plugins/google-genai build: passedpnpm --dir js/plugins/google-genai check: passedpnpm --dir js/plugins/google-genai test(after fix): 996 pass, 0 failTriage
Fixes #4
Accountable: @ssbushi
Opened by the Genkit factory (agy). A human must review and approve before merge.