Skip to content

Conversation

@bkendall
Copy link
Contributor

@bkendall bkendall commented Nov 10, 2025

Description

Replaces usage of googleapis with a custom API handler. We try not to include googleapis because it's such a large package.

Fixes #9443

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @bkendall, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request aims to optimize the application by removing the dependency on the large googleapis package. It achieves this by implementing a custom, lightweight API handler specifically for the Cloud Testing API, thereby reducing the overall bundle size and resolving an issue where googleapis was unavailable in certain server environments. This change improves efficiency and maintainability by providing a more tailored API interaction.

Highlights

  • googleapis Replacement: The googleapis library has been replaced with a custom API handler for the Cloud Testing API to reduce package size and resolve server issues where the full library might not be available.
  • New API Module: A new module, src/gcp/apptesting.ts, was introduced to encapsulate a custom API client and the testEnvironmentCatalog function specifically for the Cloud Testing API.
  • API Origin Definition: A new cloudTestingOrigin function was added in src/api.ts to define the base URL for the Cloud Testing API, allowing for environment overrides.
  • Tool Update: The check_status tool in src/mcp/tools/apptesting/tests.ts was updated to utilize the new custom testEnvironmentCatalog function and now explicitly declares requiresAuth and requiresProject in its metadata.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@bkendall bkendall changed the title Bk no googleapis fixed googleapis issue Nov 10, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully replaces the googleapis dependency with a custom API handler for fetching the app testing environment catalog, which is a great move to reduce the overall package size. The implementation is solid, but I have a couple of suggestions to enhance type safety and add robustness to the new logic.

Comment on lines 112 to 114
if (getAvailableDevices) {
const testing = google.testing("v1");
devices = await testing.testEnvironmentCatalog.get({
oauth_token: await getAccessToken(),
environmentType: "ANDROID",
});
devices = await testEnvironmentCatalog(projectId || "", "ANDROID");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Passing an empty string for projectId when it's missing could lead to a cryptic backend error. Since this tool now explicitly requires a project, it's safer to fail fast with a clear error message if projectId is not available. Please add a check to ensure projectId is present before making the API call.

    if (getAvailableDevices) {
      if (!projectId) {
        throw new FirebaseError("Project ID is required to get available devices but is missing.");
      }
      devices = await testEnvironmentCatalog(projectId, "ANDROID");
    }

Comment on lines +20 to +28
type TestEnvironmentCatalog = unknown;

/**
* Gets the catalog of supported test environments.
*/
export async function testEnvironmentCatalog(
projectId: string,
environmentType: EnvironmentType,
): Promise<unknown> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using unknown for TestEnvironmentCatalog and the function's return type reduces type safety and makes the response harder to work with for consumers of this function. It would be beneficial to define a proper type for the TestEnvironmentCatalog based on the expected API response structure. Even a partial type definition with a TODO to fill it out later would be an improvement over unknown.

Suggested change
type TestEnvironmentCatalog = unknown;
/**
* Gets the catalog of supported test environments.
*/
export async function testEnvironmentCatalog(
projectId: string,
environmentType: EnvironmentType,
): Promise<unknown> {
interface TestEnvironmentCatalog {
// TODO: Define the properties of the test environment catalog based on the API response.
}
/**
* Gets the catalog of supported test environments.
*/
export async function testEnvironmentCatalog(
projectId: string,
environmentType: EnvironmentType,
): Promise<TestEnvironmentCatalog> {

@bkendall bkendall merged commit 0615d64 into master Nov 10, 2025
50 checks passed
@bkendall bkendall deleted the bk-no-googleapis branch November 10, 2025 18:00
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MCP] Server fails to start: Cannot find module 'googleapis'

2 participants