-
Notifications
You must be signed in to change notification settings - Fork 603
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
Speech: Unhandled exception when reusing a closed client #5464
Labels
api: speech
Issues related to the Speech-to-Text API.
Comments
orgads
added a commit
to orgads/google-cloud-node
that referenced
this issue
Jun 13, 2024
* Execute streamingRecognize * When done, close the client * Execute streamingRecognize again, with data already in the stream * Unhandled exception occurs. TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object at _write (node:internal/streams/writable:474:13) at Writable.write (node:internal/streams/writable:502:10) at Duplexify._write (/project/node_modules/duplexify/index.js:212:22) at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) at Pumpify.<anonymous> (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27) at Object.onceWrapper (node:events:633:26) at Pumpify.emit (node:events:518:28) at obj.<computed> [as _write] (/project/node_modules/stubs/index.js:28:22) at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) at PassThrough.ondata (node:internal/streams/readable:1007:22) at PassThrough.emit (node:events:518:28) at addChunk (node:internal/streams/readable:559:12) { code: 'ERR_INVALID_ARG_TYPE' This happens because streamingRecognize writes streamingConfig on first chunk. Usually the stream is open in object mode, so it works, but when the client is terminated, PassThrough is used without object mode. Change PassThrough to object mode, so it terminates gracefully. Fixes googleapis#5464.
4 tasks
danieljbruce
pushed a commit
that referenced
this issue
Jun 17, 2024
* Execute streamingRecognize * When done, close the client * Execute streamingRecognize again, with data already in the stream * Unhandled exception occurs. TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object at _write (node:internal/streams/writable:474:13) at Writable.write (node:internal/streams/writable:502:10) at Duplexify._write (/project/node_modules/duplexify/index.js:212:22) at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) at Pumpify.<anonymous> (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27) at Object.onceWrapper (node:events:633:26) at Pumpify.emit (node:events:518:28) at obj.<computed> [as _write] (/project/node_modules/stubs/index.js:28:22) at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) at PassThrough.ondata (node:internal/streams/readable:1007:22) at PassThrough.emit (node:events:518:28) at addChunk (node:internal/streams/readable:559:12) { code: 'ERR_INVALID_ARG_TYPE' This happens because streamingRecognize writes streamingConfig on first chunk. Usually the stream is open in object mode, so it works, but when the client is terminated, PassThrough is used without object mode. Change PassThrough to object mode, so it terminates gracefully. Fixes #5464. Co-authored-by: sofisl <[email protected]>
This commit was reverted in PR #5565. I've been having the same issue when closing my streamingRecognize, which is crashing my application completely. |
orgads
added a commit
to orgads/gapic-generator-typescript
that referenced
this issue
Aug 25, 2024
Example: * Execute streamingRecognize * When done, close the client * Execute streamingRecognize again, with data already in the stream * Unhandled exception occurs. TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object at _write (node:internal/streams/writable:474:13) at Writable.write (node:internal/streams/writable:502:10) at Duplexify._write (/project/node_modules/duplexify/index.js:212:22) at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) at Pumpify.<anonymous> (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27) at Object.onceWrapper (node:events:633:26) at Pumpify.emit (node:events:518:28) at obj.<computed> [as _write] (/project/node_modules/stubs/index.js:28:22) at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) at PassThrough.ondata (node:internal/streams/readable:1007:22) at PassThrough.emit (node:events:518:28) at addChunk (node:internal/streams/readable:559:12) { code: 'ERR_INVALID_ARG_TYPE' Reproduction: https://gist.github.com/orgads/13cbf44c91923da27d8772b5f10489c9 This happens because streamingRecognize writes streamingConfig on first chunk. Usually the stream is open in object mode, so it works, but when the client is terminated, PassThrough is used without object mode. Change PassThrough to object mode, so it terminates gracefully. This was reported in [1] and fixed in [2], but was then reverted in [3] which re-generated the code. Fix properly in the generator now. [1] googleapis/google-cloud-node#5464 [2] googleapis/google-cloud-node#5465 [3] googleapis/google-cloud-node#5565
@vx-gulliver Thank you for catching that! I pushed a new PR for the generator here: googleapis/gapic-generator-typescript#1640 |
orgads
added a commit
to orgads/gapic-generator-typescript
that referenced
this issue
Aug 25, 2024
Example: * Execute streamingRecognize * When done, close the client * Execute streamingRecognize again, with data already in the stream * Unhandled exception occurs. TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object at _write (node:internal/streams/writable:474:13) at Writable.write (node:internal/streams/writable:502:10) at Duplexify._write (/project/node_modules/duplexify/index.js:212:22) at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) at Pumpify.<anonymous> (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27) at Object.onceWrapper (node:events:633:26) at Pumpify.emit (node:events:518:28) at obj.<computed> [as _write] (/project/node_modules/stubs/index.js:28:22) at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) at PassThrough.ondata (node:internal/streams/readable:1007:22) at PassThrough.emit (node:events:518:28) at addChunk (node:internal/streams/readable:559:12) { code: 'ERR_INVALID_ARG_TYPE' Reproduction: https://gist.github.com/orgads/13cbf44c91923da27d8772b5f10489c9 This happens because streamingRecognize writes streamingConfig on first chunk. Usually the stream is open in object mode, so it works, but when the client is terminated, PassThrough is used without object mode. Change PassThrough to object mode, so it terminates gracefully. This was reported in [1] and fixed in [2], but was then reverted in [3] which re-generated the code. Fix properly in the generator now. [1] googleapis/google-cloud-node#5464 [2] googleapis/google-cloud-node#5465 [3] googleapis/google-cloud-node#5565
sofisl
added a commit
to googleapis/gapic-generator-typescript
that referenced
this issue
Aug 30, 2024
Example: * Execute streamingRecognize * When done, close the client * Execute streamingRecognize again, with data already in the stream * Unhandled exception occurs. TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object at _write (node:internal/streams/writable:474:13) at Writable.write (node:internal/streams/writable:502:10) at Duplexify._write (/project/node_modules/duplexify/index.js:212:22) at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) at Pumpify.<anonymous> (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27) at Object.onceWrapper (node:events:633:26) at Pumpify.emit (node:events:518:28) at obj.<computed> [as _write] (/project/node_modules/stubs/index.js:28:22) at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139) at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5) at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11) at PassThrough.ondata (node:internal/streams/readable:1007:22) at PassThrough.emit (node:events:518:28) at addChunk (node:internal/streams/readable:559:12) { code: 'ERR_INVALID_ARG_TYPE' Reproduction: https://gist.github.com/orgads/13cbf44c91923da27d8772b5f10489c9 This happens because streamingRecognize writes streamingConfig on first chunk. Usually the stream is open in object mode, so it works, but when the client is terminated, PassThrough is used without object mode. Change PassThrough to object mode, so it terminates gracefully. This was reported in [1] and fixed in [2], but was then reverted in [3] which re-generated the code. Fix properly in the generator now. [1] googleapis/google-cloud-node#5464 [2] googleapis/google-cloud-node#5465 [3] googleapis/google-cloud-node#5565 Co-authored-by: sofisl <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please make sure you have searched for information in the following guides.
A screenshot that you have tested with "Try this API".
N/A
Link to the code that reproduces this issue. A link to a public Github Repository with a minimal reproduction.
https://gist.github.com/orgads/13cbf44c91923da27d8772b5f10489c9
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
Change MY_PROJECT to your project name, add credentials if needed and run.
A clear and concise description of what the bug is, and what you expected to happen.
The application crashes with the following exception (which there is no way to catch). It should just emit
error
, and allow graceful handling.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. **
No library should crash an application this way.
The text was updated successfully, but these errors were encountered: