Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using access token obtained via gcloud auth print-access-token with @google-cloud/logging v11.2.0 #1531

Open
katsuya opened this issue Oct 12, 2024 · 0 comments
Assignees
Labels
api: logging Issues related to the googleapis/nodejs-logging API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@katsuya
Copy link

katsuya commented Oct 12, 2024

When using the command gcloud auth print-access-token --lifetime=3600 --impersonate-service-account=xxx to obtain an access_token and calling the following method:

getEntries(options?: GetEntriesRequest): Promise<GetEntriesResponse>;
, the following error occurs:

The options sent were:

{
    orderBy: 'timestamp desc',
    resourceNames: [ 'projects/xxx' ],
    filter: '\n' +
      '      resource.type="k8s_pod"\n' +
      '      resource.labels.cluster_name="xxx"\n' +
      '      resource.labels.location="asia-northeast1"\n' +
      '      jsonPayload.reason="Pulled"\n' +
      '      jsonPayload.metadata.namespace="default"\n' +
      '      timestamp >= "2024-09-12T08:05:52.957Z"\n' +
      '    ',
    pageSize: 500
}

The error returned is:

/masked_path/node_modules/google-gax/node_modules/@grpc/grpc-js/src/call.ts:85
}
 ^
Error: 2 UNKNOWN: Getting metadata from plugin failed with error: key must be a string, a buffer or an object
    at callErrorFromStatus (/masked_path/node_modules/google-gax/node_modules/@grpc/grpc-js/src/call.ts:85:2)
    at Object.onReceiveStatus (/masked_path/node_modules/google-gax/node_modules/@grpc/grpc-js/src/client.ts:360:55)
    at Object.onReceiveStatus (/masked_path/node_modules/google-gax/node_modules/@grpc/grpc-js/src/client-interceptors.ts:458:34)
    at Object.onReceiveStatus (/masked_path/node_modules/google-gax/node_modules/@grpc/grpc-js/src/client-interceptors.ts:419:48)
    at /masked_path/node_modules/google-gax/node_modules/@grpc/grpc-js/src/resolving-call.ts:163:24
    at processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
    at ServiceClientImpl.makeUnaryRequest (/masked_path/node_modules/google-gax/node_modules/@grpc/grpc-js/src/client.ts:325:42)
    at ServiceClientImpl.<anonymous> (/masked_path/node_modules/google-gax/node_modules/@grpc/grpc-js/src/make-client.ts:189:15)
    at /masked_path/node_modules/@google-cloud/logging/src/v2/logging_service_v2_client.ts:440:9
    at wrappedCall (/masked_path/node_modules/google-gax/build/src/paginationCalls/pagedApiCaller.js:86:20)
    at /masked_path/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16
    at repeat (/masked_path/node_modules/google-gax/build/src/normalCalls/retries.js:82:25)
    at /masked_path/node_modules/google-gax/build/src/normalCalls/retries.js:125:13
    at OngoingCallPromise.call (/masked_path/node_modules/google-gax/build/src/call.js:67:27)
    at PagedApiCaller.call (/masked_path/node_modules/google-gax/build/src/paginationCalls/pagedApiCaller.js:118:25)
    at /masked_path/node_modules/google-gax/build/src/createApiCall.js:112:30 {
  code: 2,
  details: 'Getting metadata from plugin failed with error: key must be a string, a buffer or an object',
  metadata: Metadata { internalRepr: Map(0) {}, options: {} },
  note: 'Exception occurred in retry method that was not classified as transient'
}

Is this the intended behavior? I understand that access tokens are accepted for authentication by most Google APIs. Does this API not support access tokens? It would be greatly appreciated if access token support could be added.

Environment details

  • OS: macOS
  • Node.js version: 20.18.0
  • npm version: 10.8.2
  • @google-cloud/logging version: v11.2.0

Steps to reproduce

  1. get access token from gcloud auth print-access-token --lifetime=3600 --impersonate-service-account=xxx
  2. get logs from getEntries
@katsuya katsuya added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 12, 2024
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/nodejs-logging API. label Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/nodejs-logging API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants