这是indexloc提供的服务,不要输入任何密码
Skip to content

Unable to deploy with VPC from external shared project #6327

@steveoh

Description

@steveoh

[REQUIRED] Environment info

firebase-tools: 12.5.2

Platform: macos

[REQUIRED] Test case

Trying to use a shared vpc from a different project with .env and

FUNCTION_VPC="projects/shared/locations/us-central1/connectors/shared"
const vpc = params.defineString('FUNCTION_VPC');
setGlobalOptions({
  vpcConnector: vpc
});

[REQUIRED] Steps to reproduce

Try to deploy with these values and firebase tools mutates the vpcConnector string to an invalid value.

functions: HTTP Error: 400, Could not update Cloud Run service projects/my-project/locations/us-central1/services/function. spec.template.metadata.annotations: Expected a VPC access connector name like projects/*/locations/*/connectors/*, but obtained projects/not-shared-project/locations/us-central1/connectors/{{the full value of the FUNCTION_VPC}}

I assume the issue is around

if (annotation.vpcConnector != null) {
let maybeId = annotation.vpcConnector;
if (maybeId && !maybeId.includes("/")) {
maybeId = `projects/${projectId}/locations/${region}/connectors/${maybeId}`;
}
endpoint.vpc = { connector: maybeId };
proto.renameIfPresent(
endpoint.vpc,
annotation,
"egressSettings",
"vpcConnectorEgressSettings"
);
}

But my connector has a / in it so it shouldn't get modified. I wonder if it has to do with the Expression<string> type that has a .value() not being invoked or something until later? Or maybe the / is encoded when read from the environment file?

[REQUIRED] Expected behavior

The VPC value I specify is used

[REQUIRED] Actual behavior

The string is mutated and the deployment fails.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions