Describe the bug
Node.js version: v25.1.0
OS version: macOS Tahoe 26.1
Description: Getting an error "2 UNKNOWN: Getting metadata from plugin failed with error: Unexpected Gaxios Error" while trying to retrieve the GCP secret.
Actual behavior
Getting an error "2 UNKNOWN: Getting metadata from plugin failed with error: Unexpected Gaxios Error" while trying to retrieve the GCP secret.
Expected behavior
Should be able to retrieve the GCP secrets successfully without any errors.
Code to reproduce
import request, { Response } from "supertest";
describe("Endpoints", () => {
let authToken: string;
beforeAll(async () => {
authToken = await getAccessToken(BASE_URL);
});
export async function getAccessToken(baseUrl: string): Promise {
const username = await getSecretValue("<secret_name>");
const reqBody = "<request_body>";
request(baseUrl)
.post("/auth/token")
.auth(username)
.set("Content-Type", "application/x-www-form-urlencoded")
.send(reqBody);
}
import { SecretManagerServiceClient } from '@google-cloud/secret-manager';
import { gcp_secret_project_name } from '../../config';
const client = new SecretManagerServiceClient();
export async function getSecretValue(secretId: string): Promise {
const [version] = await client.accessSecretVersion({
name: projects/${gcp_secret_project_name}/secrets/${secretId}/versions/latest,
});
return version.payload?.data?.toString() || '';
}
Failing in this line of code: await client.accessSecretVersion({
name: projects/${gcp_secret_project_name}/secrets/${secretId}/versions/latest,
});
with:
2 UNKNOWN: Getting metadata from plugin failed with error: Unexpected Gaxios Error
Checklist
Describe the bug
Node.js version: v25.1.0
OS version: macOS Tahoe 26.1
Description: Getting an error "2 UNKNOWN: Getting metadata from plugin failed with error: Unexpected Gaxios Error" while trying to retrieve the GCP secret.
Actual behavior
Getting an error "2 UNKNOWN: Getting metadata from plugin failed with error: Unexpected Gaxios Error" while trying to retrieve the GCP secret.
Expected behavior
Should be able to retrieve the GCP secrets successfully without any errors.
Code to reproduce
import request, { Response } from "supertest";
describe("Endpoints", () => {
let authToken: string;
beforeAll(async () => {
authToken = await getAccessToken(BASE_URL);
});
export async function getAccessToken(baseUrl: string): Promise {
const username = await getSecretValue("<secret_name>");
const reqBody = "<request_body>";
request(baseUrl)
.post("/auth/token")
.auth(username)
.set("Content-Type", "application/x-www-form-urlencoded")
.send(reqBody);
}
import { SecretManagerServiceClient } from '@google-cloud/secret-manager';
import { gcp_secret_project_name } from '../../config';
const client = new SecretManagerServiceClient();
export async function getSecretValue(secretId: string): Promise {
const [version] = await client.accessSecretVersion({
name:
projects/${gcp_secret_project_name}/secrets/${secretId}/versions/latest,});
return version.payload?.data?.toString() || '';
}
Failing in this line of code: await client.accessSecretVersion({
name:
projects/${gcp_secret_project_name}/secrets/${secretId}/versions/latest,});
with:
2 UNKNOWN: Getting metadata from plugin failed with error: Unexpected Gaxios ErrorChecklist