-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
[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
firebase-tools/src/deploy/functions/runtimes/node/parseTriggers.ts
Lines 502 to 514 in 09c8d88
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.