Please make sure you have searched for information in the following guides.
Library Name
gcp_metadata
A screenshot that you have tested with "Try this API".
The gcp-metadata library isn't a standard Google API that has an APIs Explorer page, so skipping this step.
Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.
https://gist.github.com/kcolton-jpg/e30d122f7417cf63d40bdf867ae5e74c
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
- Initialize a new Node.js project and install the
gcp-metadata library
- Download the reproduction script from the linked Gist and save it as reproduce.js.
- Run the script locally.
- Observe the output: The script simulates a Cloud Run Worker Pool environment by setting CLOUD_RUN_WORKER_POOL and verifying that other serverless environment variables (K_SERVICE, etc.) are unset.
The call to isGoogleCloudServerless() will output false.It should output true.
A clear and concise description of what the bug is, and what you expected to happen.
The gcp-metadata library fails to recognize Google Cloud Run Worker Pools as a serverless environment. The environment detection logic in isGoogleCloudServerless() checks for CLOUD_RUN_JOB, FUNCTION_NAME, and K_SERVICE, but is missing a check for CLOUD_RUN_WORKER_POOL.
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
The isGoogleCloudServerless() function should additionally check for process.env.CLOUD_RUN_WORKER_POOL. When running in a Cloud Run Worker Pool, it should return true.
Please make sure you have searched for information in the following guides.
Library Name
gcp_metadata
A screenshot that you have tested with "Try this API".
The gcp-metadata library isn't a standard Google API that has an APIs Explorer page, so skipping this step.
Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.
https://gist.github.com/kcolton-jpg/e30d122f7417cf63d40bdf867ae5e74c
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
gcp-metadatalibraryThe call to isGoogleCloudServerless() will output false.It should output true.
A clear and concise description of what the bug is, and what you expected to happen.
The gcp-metadata library fails to recognize Google Cloud Run Worker Pools as a serverless environment. The environment detection logic in isGoogleCloudServerless() checks for CLOUD_RUN_JOB, FUNCTION_NAME, and K_SERVICE, but is missing a check for CLOUD_RUN_WORKER_POOL.
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
The isGoogleCloudServerless() function should additionally check for process.env.CLOUD_RUN_WORKER_POOL. When running in a Cloud Run Worker Pool, it should return true.