镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(gcp-metadata): support CLOUD_RUN_WORKER_POOL residency detection and harden isAvailable error unwrapping - #9349

Merged
quirogas merged 4 commits into
googleapis:mainfrom
quirogas:fix-gcp-metadata-worker-pool
Sep 16, 2026
Merged

quirogas merged 4 commits into
googleapis:mainfrom
quirogas:fix-gcp-metadata-worker-pool

Conversation

@quirogas

Copy link
Copy Markdown
Contributor

Follow-up to #9226 (Fixes #9225).

Summary of Changes

  1. Linter & JSDoc Fixes in src/gcp-residency.ts:
    • Removes the trailing space after process.env.K_SERVICE || that caused presubmit/lint (prettier/prettier & no-trailing-spaces) to fail in chore: update IsGoogleCloudServerless function to check for Cloud Run Worker Pools #9226.
    • Replaces the internal http://cloud/run/docs/deploy-worker-pools link with the public Google Cloud documentation URL (https://cloud.google.com/run/docs/deploy-worker-pools) and clarifies that CLOUD_RUN_WORKER_POOL applies to Cloud Run Worker Pools.
  2. Unwrap AggregateError and AbortError Codes in src/index.ts:
    • Maps AbortError / aborted / request-timeout to ETIMEDOUT in getErrorCodes().
    • Uses the unwrapped error codes (Array.from(new Set(codes)).join(', ')) instead of defaulting to 'UNKNOWN' when emitting MetadataLookupWarning for AggregateError (when Promise.any rejects).
  3. Unit Tests & Hermetic Test Isolation:
    • Adds delete customEnv.CLOUD_RUN_WORKER_POOL; to removeServerlessEnvironmentVariables() in test/utils/gcp-residency.ts.
    • Adds unit test coverage for CLOUD_RUN_WORKER_POOL in test/gcp-residency.test.ts.
    • Adds unit test coverage verifying AggregateError code unwrapping in MetadataLookupWarning in test/index.test.ts.

@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 updates the GCP metadata package to improve error handling and environment detection. Specifically, it handles abort and timeout errors by mapping them to 'ETIMEDOUT', extracts nested error codes from err.error, and formats unexpected error codes more clearly in warnings. Additionally, it updates documentation and adds test coverage for the CLOUD_RUN_WORKER_POOL environment variable. No review comments were provided, so there is no additional feedback.

@quirogas
quirogas force-pushed the fix-gcp-metadata-worker-pool branch from 26a4380 to e832159 Compare September 16, 2026 00:02
@quirogas quirogas changed the title fix(gcp-metadata): add unit tests and unwrap AggregateError codes for Cloud Run Worker Pools fix(gcp-metadata): unwrap AggregateError and timeout codes in isAvailable and support CLOUD_RUN_WORKER_POOL Sep 16, 2026
@quirogas quirogas changed the title fix(gcp-metadata): unwrap AggregateError and timeout codes in isAvailable and support CLOUD_RUN_WORKER_POOL fix(gcp-metadata): support CLOUD_RUN_WORKER_POOL residency detection and harden isAvailable error unwrapping Sep 16, 2026
@quirogas
quirogas marked this pull request as ready for review September 16, 2026 14:49
@quirogas
quirogas requested a review from a team as a code owner September 16, 2026 14:49
@github-actions
github-actions Bot requested a review from feywind September 16, 2026 14:49
@quirogas
quirogas enabled auto-merge (squash) September 16, 2026 14:52
@quirogas
quirogas merged commit 10b654f into googleapis:main Sep 16, 2026
51 checks passed
@release-please release-please Bot mentioned this pull request Sep 16, 2026
danieljbruce pushed a commit that referenced this pull request Sep 16, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>gcp-metadata: 9.0.4</summary>

##
[9.0.4](gcp-metadata-v9.0.3...gcp-metadata-v9.0.4)
(2026-09-16)


### Bug Fixes

* **gcp-metadata:** Support CLOUD_RUN_WORKER_POOL residency detection
and harden isAvailable error unwrapping
([#9349](#9349))
([10b654f](10b654f))
* Update IsGoogleCloudServerless function to check for Cloud Run Worker
Pools
([#9226](#9226))
([e0ff8c5](e0ff8c5))
</details>

<details><summary>apptopology: 0.3.0</summary>

##
[0.3.0](apptopology-v0.2.0...apptopology-v0.3.0)
(2026-09-16)


### ⚠ BREAKING CHANGES

* upgrade minimum Node.js version to 22
([#9357](#9357))

### Features

* Upgrade minimum Node.js version to 22
([#9357](#9357))
([d2e6a23](d2e6a23))
</details>

<details><summary>ftp: 0.3.0</summary>

##
[0.3.0](ftp-v0.2.0...ftp-v0.3.0)
(2026-09-16)


### ⚠ BREAKING CHANGES

* upgrade minimum Node.js version to 22
([#9357](#9357))

### Features

* Upgrade minimum Node.js version to 22
([#9357](#9357))
([d2e6a23](d2e6a23))
</details>

<details><summary>tasks: 7.1.1</summary>

##
[7.1.1](tasks-v7.1.0...tasks-v7.1.1)
(2026-09-16)


### Bug Fixes

* Remove unintentionally added file
([#9356](#9356))
([99f6657](99f6657))
</details>

<details><summary>workloadidentity: 0.3.0</summary>

##
[0.3.0](workloadidentity-v0.2.0...workloadidentity-v0.3.0)
(2026-09-16)


### ⚠ BREAKING CHANGES

* upgrade minimum Node.js version to 22
([#9357](#9357))

### Features

* Upgrade minimum Node.js version to 22
([#9357](#9357))
([d2e6a23](d2e6a23))
</details>

<details><summary>loyaltycustomers: 0.3.0</summary>

##
[0.3.0](loyaltycustomers-v0.2.0...loyaltycustomers-v0.3.0)
(2026-09-16)


### ⚠ BREAKING CHANGES

* upgrade minimum Node.js version to 22
([#9357](#9357))

### Features

* Upgrade minimum Node.js version to 22
([#9357](#9357))
([d2e6a23](d2e6a23))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
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.

IsGoogleCloudServerless function is missing check for Cloud Run Worker Pools

2 participants