Fix VertexAI scope argument for GCE credentials#520
Open
jesse-spevack wants to merge 3 commits intocrmne:mainfrom
Open
Fix VertexAI scope argument for GCE credentials#520jesse-spevack wants to merge 3 commits intocrmne:mainfrom
jesse-spevack wants to merge 3 commits intocrmne:mainfrom
Conversation
Google::Auth.get_application_default expects scope as a positional argument, not a keyword argument. Passing `scope: [...]` causes Ruby to interpret it as a Hash, which triggers a TypeError in the signet gem when running on GCE: TypeError: Expected Array or String, got Hash This fix changes from keyword to positional argument syntax.
jesse-spevack
added a commit
to jesse-spevack/tts
that referenced
this pull request
Dec 1, 2025
Documents the bug we found, our workaround, and the PR submitted to fix it upstream: crmne/ruby_llm#520
18 tasks
|
Since this fixes a bug that affects us: Is there anything one can do to help this PR along? |
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.
Summary
Fixes
TypeError: Expected Array or String, got Hashwhen using VertexAI provider on Google Compute Engine with default credentials.Problem
Google::Auth.get_application_defaultexpectsscopeas a positional argument, not a keyword argument. The current code passes:Ruby interprets
scope: [...]as passing a Hash{scope: [...]}to the first positional parameter. The signet gem then raises:This only manifests when running on GCE with default credentials (not with service account key files, where authentication works differently).
How We Found This
We were running a Rails app on a GCE VM using RubyLLM 1.9.1 with the VertexAI provider. Episode processing jobs that called
RubyLLM.chat(model: "gemini-2.0-flash", provider: :vertexai).ask(prompt)were failing with:We traced the error to
signet-0.21.0/lib/signet/oauth_2/client.rb:The
new_scopewas a Hash{scope: [...]}instead of an Array.Minimal Reproduction
On a GCE VM with the
cloud-platformOAuth scope:To verify the root cause:
Solution
Change from keyword to positional argument:
Testing
get_application_defaultis called with an Array, not a Hashcloud-platformOAuth scopeEnvironment