Skip to content

Unable to connect Cloud SQL with Firebase Functions V2 #1375

Open
@service-paradis

Description

@service-paradis

Related issues

#1217 and #1366 that were closed without proper resolution.
I'm reopening a new issue as asked by @taeold in #1366 (comment)

[REQUIRED] Version info

node: 18.13.0

firebase-functions: 4.2.1

firebase-tools: 11.25.2

firebase-admin: 11.6.0

[REQUIRED] Test case

I am attempting to migrate a Firebase Functions project from V1 to V2 to try out beta features. However, it appears that Cloud SQL connections are not yet supported in V2. Cloud SQL connection works automatically and required no actions. It would be beneficial if connecting to a Cloud SQL instance using V2 could be made as simple as it was before.

[REQUIRED] Steps to reproduce

  1. Create a Firebase Function that connects to a Cloud SQL database using a socket path like /cloudsql/INSTANCE_CONNECTION_NAME.
  2. Call this function.
  3. Receive an ENOENT error that was not received using V1.

[REQUIRED] Expected behavior

I expected that Cloud SQL would be available to the function as it was in V1.

[REQUIRED] Actual behavior

I got ENOENT error while trying to connect to the database. As mentioned in #1217, I tried a few things to make this works without any success. @Berlioz mentioned in #1366 (comment) that configuration could be made using Cloud Run configuration. Unfortunately, it does not work. Even if it worked, this is not the expected solution since Cloud SQL database connections were automatically supported in V1.

Even if there is a solution using Cloud Run configuration in Google console eventually, V1 already works automatically, so it would be beneficial if connecting to a Cloud SQL instance using V2 could be made as simple as it was before.

Were you able to successfully deploy your functions?

Yes, without any errors. The function itself seems to be working as expected, but it cannot connect to a Cloud SQL instance.

Ideally, Cloud SQL database connections should be established seamlessly, without requiring any manual service updates. In version 1 of Firebase Functions, Cloud SQL database connections were automatically supported. Therefore, it is reasonable to expect that version 2 should also provide this functionality with minimal additional effort.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions