google-cloud-node icon indicating copy to clipboard operation
google-cloud-node copied to clipboard

ChatServiceClient.uploadAttachment does not work

Open mitchierichie opened this issue 11 months ago • 2 comments

Please make sure you have searched for information in the following guides.

  • [x] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
  • [x] Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
  • [x] Check our Troubleshooting guide: https://github.com/googleapis/google-cloud-node/blob/main/docs/troubleshooting.md
  • [x] Check our FAQ: https://github.com/googleapis/google-cloud-node/blob/main/docs/faq.md
  • [x] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
  • [x] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
  • [x] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples

A screenshot that you have tested with "Try this API".

Uploading attachments to Google Chat via the Node.js Google Chat SDK is not working.

 interface IUploadAttachmentRequest {
    /** UploadAttachmentRequest parent */
    parent?: (string|null);

    /** UploadAttachmentRequest filename */
    filename?: (string|null);
}

Note that the interface does not have a property for the media body.

Example usage is something like this:

chatServiceClient.uploadAttachment({parent, filename}) as shown in the samples/docs.

Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.

https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.upload_attachment.js

A step-by-step description of how to reproduce the issue, based on the linked reproduction.

Follow the official sample in the link above

A clear and concise description of what the bug is, and what you expected to happen.

File attachment is not uploaded as expected, see this error:

Error: 13 INTERNAL: Internal error encountered.
    at callErrorFromStatus (/Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/@grpc/grpc-js/src/call.ts:82:17)
    at Object.onReceiveStatus (/Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/@grpc/grpc-js/src/client.ts:360:55)
    at Object.onReceiveStatus (/Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/@grpc/grpc-js/src/client-interceptors.ts:458:34)
    at Object.onReceiveStatus (/Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/@grpc/grpc-js/src/client-interceptors.ts:419:48)
    at /Users/mitchie/PhpstormProjects/mio-universal/tests/uat/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 (/Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/@grpc/grpc-js/src/client.ts:325:42)
    at ServiceClientImpl.<anonymous> (/Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/@grpc/grpc-js/src/make-client.ts:189:15)
    at /Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/@google-apps/chat/src/v1/chat_service_client.ts:357:25
    at /Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16
    at repeat (/Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/google-gax/build/src/normalCalls/retries.js:82:25)
    at /Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/google-gax/build/src/normalCalls/retries.js:125:13
    at OngoingCallPromise.call (/Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/google-gax/build/src/call.js:67:27)
    at NormalApiCaller.call (/Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js:34:19)
    at /Users/mitchie/PhpstormProjects/mio-universal/tests/uat/node_modules/google-gax/build/src/createApiCall.js:112:30 {
  code: 13,
  details: 'Internal error encountered.',
  metadata: Metadata {
    internalRepr: Map(3) {
      'endpoint-load-metrics-bin' => [Array],
      'grpc-server-stats-bin' => [Array],
      'pc-high-bwd-bin' => [Array]
    },
    options: {}
  },
  note: 'Exception occurred in retry method that was not classified as transient'
}

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

See the included sample and this documentation:

https://developers.google.com/workspace/chat/api/reference/rest/v1/media/upload

mitchierichie avatar Jan 16 '25 16:01 mitchierichie

Issue was opened with an invalid reproduction link. Please make sure the repository is a valid, publicly-accessible github repository, and make sure the url is complete (example: https://github.com/googleapis/google-cloud-node)

github-actions[bot] avatar Jan 16 '25 16:01 github-actions[bot]

@sofisl thanks for reopening 🙏🏻

mitchierichie avatar Jan 16 '25 18:01 mitchierichie