-
Notifications
You must be signed in to change notification settings - Fork 661
Fix 403 Error in LiveGenerativeModel due to missing Android Package headers #7632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix 403 Error in LiveGenerativeModel due to missing Android Package headers #7632
Conversation
…eaders - Located the `getWebSocketSession` function in `APIController.kt`. - Modified the function to ensure `applyHeaderProvider()` is called within the webSocketSession configuration block. - Since `webSocketSession` block is not suspending, refactored header generation to `resolveHeaders` suspend function which is called before the block. - Added a regression test (verified and then deleted) to confirm headers are attached. - Verified that headers are correctly attached.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
Generated by 🚫 Danger |
Coverage Report 1Affected ProductsNo changes between base commit (c8ada3c) and merge commit (9baf160).Test Logs |
Size Report 1Affected Products
Test Logs |
…eaders - Located the `getWebSocketSession` function in `APIController.kt`. - Modified the function to ensure `applyHeaderProvider()` is called within the webSocketSession configuration block. - Refactored header generation to `resolveHeaders` suspend function which is called before the block to handle Ktor's non-suspending configuration block. - Applied resolved headers manually inside the block to ensure `X-Android-Package` and `X-Android-Cert` are present. - Verified that headers are correctly attached with a test.
This change fixes a 403 Forbidden error when using LiveGenerativeModel with API keys restricted to Android applications. The WebSocket handshake was missing the required X-Android-Package and X-Android-Cert headers. This patch ensures these headers are generated and applied during the WebSocket session establishment.
PR created automatically by Jules for task 17608199821067667969 started by @ryanwilson