Skip to content

Add GCF V1's FUNCTION_REGION env var to V2 - #10862

Merged
inlined merged 4 commits into
mainfrom
inlined.v2-function-region
Jul 29, 2026
Merged

Add GCF V1's FUNCTION_REGION env var to V2#10862
inlined merged 4 commits into
mainfrom
inlined.v2-function-region

Conversation

@inlined

@inlined inlined commented Jul 29, 2026

Copy link
Copy Markdown
Member

What it says on the tin

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

Copy link
Copy Markdown
Contributor

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 restores the automatic injection of the FUNCTION_REGION environment variable for Cloud Functions v2 to maintain backward compatibility with v1 behavior, updating both the deployment logic and unit tests. The review feedback suggests using the in operator to check for the existence of the FUNCTION_REGION key rather than a falsy check, preventing the accidental overriding of explicitly set falsy values (such as empty strings).

Comment thread src/gcp/cloudfunctionsv2.ts Outdated
@inlined
inlined enabled auto-merge (squash) July 29, 2026 20:47

@ajperel ajperel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you may have accidentally mostly duplciated the code?

Also this is good enough but you could write a test for not overriding a user supplied value.

Comment thread src/gcp/cloudfunctionsv2.ts Outdated
{ exit: 1 },
);
}
gcfFunction.serviceConfig.environmentVariables["FUNCTION_REGION"] = endpoint.region;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is all this logic repeated again, this time without if (!gcfFunction.serviceConfig.environmentVariables["FUNCTION_REGION"]) {

@inlined
inlined merged commit 3b2c067 into main Jul 29, 2026
49 of 53 checks passed
@inlined
inlined deleted the inlined.v2-function-region branch July 29, 2026 21:36
tagboola pushed a commit that referenced this pull request Aug 5, 2026
* Add GCF V1's FUNCTION_REGION env var to V2

* Changelog
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