E542 [FDC] Support private IP Cloud SQL with VPC by fredzqm · Pull Request #9200 · firebase/firebase-tools · GitHub
[go: up one dir, main page]

Skip to content

Conversation

fredzqm
Copy link
Contributor
@fredzqm fredzqm commented Sep 26, 2025

Required settings

  const op = await client.patch<Partial<Instance>, Operation>(
    `projects/${instance.project}/instances/${instance.name}`,
    {
      settings: {
        ipConfiguration: {
          enablePrivatePathForGoogleCloudServices: /** iff has private IP */,
        },
        databaseFlags: dbFlags,
        enableGoogleMlIntegration,
      },
    },
  );

firebase deploy with a private IP instance

Screenshot 2025-09-26 at 4 15 50 PM Screenshot 2025-09-26 at 4 16 16 PM

In a GCE VM within the VPC

Screenshot 2025-09-26 at 4 53 24 PM Screenshot 2025-09-26 at 4 55 07 PM

Copy link
Contributor

Summary of Changes

Hello @fredzqm, 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 significantly enhances Firebase Data Connect by enabling it to interact with Cloud SQL instances configured with private IP addresses within a VPC. This change moves away from a strict public IP requirement, offering greater flexibility and security for database deployments. The system now intelligently detects and utilizes the appropriate IP type for connections, ensuring seamless operation whether the instance is public or private.

Highlights

  • Private IP Support for Cloud SQL: This pull request introduces support for connecting to Cloud SQL instances using private IP addresses within a Virtual Private Cloud (VPC) for Firebase Data Connect operations.
  • Dynamic IP Type Detection: The connection logic has been updated to dynamically determine whether a Cloud SQL instance uses a public or private IP address, adapting the connection strategy accordingly.
  • Migration Tooling Adjustment: The firebase dataconnect:sql:migrate command now issues a warning instead of failing if a Cloud SQL instance lacks a public IP, clarifying that migration can proceed within the VPC for private IP instances.
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< 10BC0 /th> 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.

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 introduces support for private IP Cloud SQL instances in Firebase Data Connect. The changes correctly detect the IP type and use it when establishing a connection. Additionally, the provisioning logic is updated to warn about private IPs instead of forcing a public IP. My review includes a couple of minor suggestions for code cleanup: removing a debug log statement and addressing an outdated comment to improve maintainability.

@fredzqm fredzqm requested a review from yuchenshi September 26, 2025 23:58
@fredzqm fredzqm changed the title [FDC] Support private ip with VPC [FDC] Support private IP with VPC Sep 26, 2025
@fredzqm fredzqm changed the title [FDC] Support private IP with VPC [FDC] Support private IP Cloud SQL with VPC Sep 27, 2025
@joehan
Copy link
Contributor
joehan commented Sep 29, 2025

The error message for failing to connect to the private instance is pretty obscure right now. Is it feasbile to catch the error and give a bit more guidance?

@fredzqm
Copy link
Contributor Author
fredzqm commented Sep 29, 2025

The error message for failing to connect to the private instance is pretty obscure right now. Is it feasbile to catch the error and give a bit more guidance?

I added a warning about private IP only instance, hoping that gives folks some leads to investigate.

Yeah, troubleshoot why "I cannot connect CSQL" is actually a really hard problem. We don't know if private IP is the problem or something else. It's hard to know i 6880 f we are actually within the VPC.

It could be your wifi is down, connectivity Cloud SQL is not stable. Cloud SQL instance is struggling to handle connection.
Surfacing the original error is probably the best we can do, so customers can dig from there.

fredzqm and others added 2 commits September 29, 2025 13:38
Co-authored-by: Yuchen Shi <yuchenshi@google.com>
@fredzqm fredzqm enabled auto-merge (squash) September 29, 2025 20:39
@fredzqm fredzqm merged commit 926f71b into master Sep 29, 2025
48 checks passed
@fredzqm fredzqm deleted the fz/fdc-private-ip branch September 29, 2025 20:52
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Sep 29, 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.

3 participants
0