Skip to content

Commit 43c3472

Browse files
chore!: migrate to Node 18 (#1384)
* feat: New PropertyMask field which allows partial commits, lookups, and query results PiperOrigin-RevId: 635449160 Source-Link: googleapis/googleapis@dde0ec1 Source-Link: googleapis/googleapis-gen@8caa60d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGNhYTYwZDlhZWE4Mjk2NGExOWNkZjhmYWY5MTM4NDkxMWRiOGJkZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: remove redundant gRPC service config file feat: specify retry configuration PiperOrigin-RevId: 712493958 Source-Link: googleapis/googleapis@29aea41 Source-Link: googleapis/googleapis-gen@04bcbab Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDRiY2JhYjQ1MDU5ODllOTg0YjE0MDNkNDM4ZmZmYzAzMTIxNDRhZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: paging changes for bigquery fix: add x-goog-request params to headers for LRO-polling methods fix: remove extra protos in ESM & capture ESM in headers docs: update comments for a Nodejs stream object PiperOrigin-RevId: 721038181 Source-Link: googleapis/googleapis@331a41a Source-Link: googleapis/googleapis-gen@e81b4c5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTgxYjRjNWI1MjA4ODk1ZjY2M2EyNDA0ODYxNWE1OWQ1NjM2ZjQxNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix: fix typings for headers in generator PiperOrigin-RevId: 723181578 Source-Link: googleapis/googleapis@c7b69f4 Source-Link: googleapis/googleapis-gen@d1bc1ac Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDFiYzFhY2Q3NDI5NjQyMmE1Y2I2ZTBjNDAxNmM4YzQ4ZTk5ODUzOCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix: finalize fixing typings for headers in generator PiperOrigin-RevId: 723563760 Source-Link: googleapis/googleapis@2f843e2 Source-Link: googleapis/googleapis-gen@cd0f9c6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2QwZjljNmZlMWRkNzdjNTUyZWY3NjZlNjA0N2Y4ZGNmZDNiY2MyZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: update copyright year for auto-generated protos PiperOrigin-RevId: 731738802 Source-Link: googleapis/googleapis@d72ca0d Source-Link: googleapis/googleapis-gen@2734992 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjczNDk5MjBkYWU2Y2Q0YzJhNTFjMWM1YjRiNDNlMmMwMGYwMjk2NiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: update copyright year for auto-generated protos PiperOrigin-RevId: 732130682 Source-Link: googleapis/googleapis@9415ba0 Source-Link: googleapis/googleapis-gen@2905f83 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjkwNWY4MzM3NTZjMmIyMGIzMjgyYmU4NGI1MTFlMDQwZmU1NGYzMyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: update typescript gapic generator to 4.8.1 feat: add request/response debug logging to gapics, update templates to gax 5 and node 18 (#1671) fix: add json files to tsconfig templates (#1692) (ba6be1d) PiperOrigin-RevId: 735896588 Source-Link: googleapis/googleapis@3419af7 Source-Link: googleapis/googleapis-gen@f35ba11 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjM1YmExMTQyZjRlMTY4MjIyMzI3ZDg5MmI1ZjZlZTkwOGU1ZDQ2MSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: await/catch promises, and update listOperationsAsync return type PiperOrigin-RevId: 738212310 Source-Link: googleapis/googleapis@803b234 Source-Link: googleapis/googleapis-gen@4f44bd2 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGY0NGJkMmJhYThkZDVhNzFjYTBjZWJkYjE2NGMzYzM0MzQxZWQ4NyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Resolve the linting errors * Run the migration script * Delete the migration script * Add files to include in compilation * Cherry picking * Add void in front of a bunch of promises * Downgrade arrify * Downgrade protobufjs * npm run fix * Fix the linting errors * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update the post-processor * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Mark the test as only * skip the samples test --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a18c169 commit 43c3472

File tree

90 files changed

+2335
-1768
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2335
-1768
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 Google LLC
1+
# Copyright 2025 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -13,5 +13,4 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest
16-
digest: sha256:22e41dd7cd82683fa338b647abcc3a29ddb1b17e800b089adc0bec0a3175312c
17-
# created: 2024-10-30T16:51:59.982020867Z
16+
digest: sha256:c7e4968cfc97a204a4b2381f3ecb55cabc40c4cccf88b1ef8bef0d976be87fee

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
1-
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
2-
- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/nodejs-datastore/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
1+
> Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
2+
3+
## Description
4+
5+
> Please provide a detailed description for the change.
6+
> As much as possible, please try to keep changes separate by purpose. For example, try not to make a one-line bug fix in a feature request, or add an irrelevant README change to a bug fix.
7+
8+
## Impact
9+
10+
> What's the impact of this change?
11+
12+
## Testing
13+
14+
> Have you added unit and integration tests if necessary?
15+
> Were any tests changed? Are any breaking changes necessary?
16+
17+
## Additional Information
18+
19+
> Any additional details that we should be aware of?
20+
21+
## Checklist
22+
23+
- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/nodejs-datastore/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
324
- [ ] Ensure the tests and linter pass
4-
- [ ] Code coverage does not decrease (if any source code was changed)
5-
- [ ] Appropriate docs were updated (if necessary)
25+
- [ ] Code coverage does not decrease
26+
- [ ] Appropriate docs were updated
27+
- [ ] Appropriate comments were added, particularly in complex areas or places that require background
28+
- [ ] No new warnings or issues will be generated from this change
629

7-
Fixes #<issue_number_goes_here> 🦕
30+
Fixes #issue_number_goes_here 🦕

.github/scripts/close-invalid-link.cjs

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,26 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
const fs = require('fs');
16+
const yaml = require('js-yaml');
17+
const path = require('path');
18+
const TEMPLATE_FILE_PATH = path.resolve(__dirname, '../ISSUE_TEMPLATE/bug_report.yml')
19+
1520
async function closeIssue(github, owner, repo, number) {
1621
await github.rest.issues.createComment({
1722
owner: owner,
1823
repo: repo,
1924
issue_number: number,
20-
body: '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)'
25+
body: "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)"
2126
});
2227
await github.rest.issues.update({
2328
owner: owner,
2429
repo: repo,
2530
issue_number: number,
26-
state: 'closed'
31+
state: "closed"
2732
});
2833
}
29-
module.exports = async ({github, context}) => {
34+
module.exports = async ({ github, context }) => {
3035
const owner = context.repo.owner;
3136
const repo = context.repo.repo;
3237
const number = context.issue.number;
@@ -37,20 +42,32 @@ module.exports = async ({github, context}) => {
3742
issue_number: number,
3843
});
3944

40-
const isBugTemplate = issue.data.body.includes('Link to the code that reproduces this issue');
45+
const yamlData = fs.readFileSync(TEMPLATE_FILE_PATH, 'utf8');
46+
const obj = yaml.load(yamlData);
47+
const linkMatchingText = (obj.body.find(x => {return x.type === 'input' && x.validations.required === true && x.attributes.label.includes('link')})).attributes.label;
48+
const isBugTemplate = issue.data.body.includes(linkMatchingText);
4149

4250
if (isBugTemplate) {
4351
console.log(`Issue ${number} is a bug template`)
4452
try {
45-
const link = issue.data.body.split('\n')[18].match(/(https?:\/\/(gist\.)?github.com\/.*)/)[0];
46-
console.log(`Issue ${number} contains this link: ${link}`)
47-
const isValidLink = (await fetch(link)).ok;
48-
console.log(`Issue ${number} has a ${isValidLink ? 'valid' : 'invalid'} link`)
49-
if (!isValidLink) {
50-
await closeIssue(github, owner, repo, number);
51-
}
53+
const text = issue.data.body;
54+
const match = text.indexOf(linkMatchingText);
55+
if (match !== -1) {
56+
const nextLineIndex = text.indexOf('http', match);
57+
if (nextLineIndex == -1) {
58+
await closeIssue(github, owner, repo, number);
59+
return;
60+
}
61+
const link = text.substring(nextLineIndex, text.indexOf('\n', nextLineIndex));
62+
console.log(`Issue ${number} contains this link: ${link}`);
63+
const isValidLink = (await fetch(link)).ok;
64+
console.log(`Issue ${number} has a ${isValidLink ? "valid" : "invalid"} link`)
65+
if (!isValidLink) {
66+
await closeIssue(github, owner, repo, number);
67+
}
68+
}
5269
} catch (err) {
5370
await closeIssue(github, owner, repo, number);
5471
}
5572
}
56-
};
73+
};
Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Google LLC
1+
/// Copyright 2024 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -13,57 +13,57 @@
1313
// limitations under the License.
1414

1515
function labeledEvent(data) {
16-
return data.event === 'labeled' && data.label.name === 'needs more info';
17-
}
18-
19-
const numberOfDaysLimit = 15;
20-
const close_message = `This has been closed since a request for information has \
21-
not been answered for ${numberOfDaysLimit} days. It can be reopened when the \
22-
requested information is provided.`;
23-
24-
module.exports = async ({github, context}) => {
25-
const owner = context.repo.owner;
26-
const repo = context.repo.repo;
27-
28-
const issues = await github.rest.issues.listForRepo({
29-
owner: owner,
30-
repo: repo,
31-
labels: 'needs more info',
32-
});
33-
const numbers = issues.data.map((e) => e.number);
34-
35-
for (const number of numbers) {
36-
const events = await github.paginate(
37-
github.rest.issues.listEventsForTimeline,
38-
{
39-
owner: owner,
40-
repo: repo,
41-
issue_number: number,
42-
},
43-
(response) => response.data.filter(labeledEvent)
44-
);
45-
46-
const latest_response_label = events[events.length - 1];
47-
48-
const created_at = new Date(latest_response_label.created_at);
49-
const now = new Date();
50-
const diff = now - created_at;
51-
const diffDays = diff / (1000 * 60 * 60 * 24);
52-
53-
if (diffDays > numberOfDaysLimit) {
54-
await github.rest.issues.update({
55-
owner: owner,
56-
repo: repo,
57-
issue_number: number,
58-
state: 'closed',
59-
});
60-
61-
await github.rest.issues.createComment({
62-
owner: owner,
63-
repo: repo,
64-
issue_number: number,
65-
body: close_message,
66-
});
67-
}
16+
return data.event === "labeled" && data.label.name === "needs more info";
17+
}
18+
19+
const numberOfDaysLimit = 15;
20+
const close_message = `This has been closed since a request for information has \
21+
not been answered for ${numberOfDaysLimit} days. It can be reopened when the \
22+
requested information is provided.`;
23+
24+
module.exports = async ({ github, context }) => {
25+
const owner = context.repo.owner;
26+
const repo = context.repo.repo;
27+
28+
const issues = await github.rest.issues.listForRepo({
29+
owner: owner,
30+
repo: repo,
31+
labels: "needs more info",
32+
});
33+
const numbers = issues.data.map((e) => e.number);
34+
35+
for (const number of numbers) {
36+
const events = await github.paginate(
37+
github.rest.issues.listEventsForTimeline,
38+
{
39+
owner: owner,
40+
repo: repo,
41+
issue_number: number,
42+
},
43+
(response) => response.data.filter(labeledEvent)
44+
);
45+
46+
const latest_response_label = events[events.length - 1];
47+
48+
const created_at = new Date(latest_response_label.created_at);
49+
const now = new Date();
50+
const diff = now - created_at;
51+
const diffDays = diff / (1000 * 60 * 60 * 24);
52+
53+
if (diffDays > numberOfDaysLimit) {
54+
await github.rest.issues.update({
55+
owner: owner,
56+
repo: repo,
57+
issue_number: number,
58+
state: "closed",
59+
});
60+
61+
await github.rest.issues.createComment({
62+
owner: owner,
63+
repo: repo,
64+
issue_number: number,
65+
body: close_message,
66+
});
6867
}
69-
};
68+
}
69+
};
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
### Please make sure you have searched for information in the following guides.
2+
3+
- [X] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
4+
- [X] Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
5+
- [X] Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting
6+
- [X] Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq
7+
- [X] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
8+
- [X] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
9+
- [X] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples
10+
11+
### A screenshot that you have tested with "Try this API".
12+
13+
14+
N/A
15+
16+
### Link to the code that reproduces this issue. A link to a **public** Github Repository or gist with a minimal reproduction.
17+
18+
not-a-link
19+
20+
### A step-by-step description of how to reproduce the issue, based on the linked reproduction.
21+
22+
23+
Change MY_PROJECT to your project name, add credentials if needed and run.
24+
25+
### A clear and concise description of what the bug is, and what you expected to happen.
26+
27+
The application crashes with the following exception (which there is no way to catch). It should just emit error, and allow graceful handling.
28+
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
29+
at _write (node:internal/streams/writable:474:13)
30+
at Writable.write (node:internal/streams/writable:502:10)
31+
at Duplexify._write (/project/node_modules/duplexify/index.js:212:22)
32+
at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139)
33+
at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5)
34+
at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11)
35+
at Pumpify.<anonymous> (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27)
36+
at Object.onceWrapper (node:events:633:26)
37+
at Pumpify.emit (node:events:518:28)
38+
at obj.<computed> [as _write] (/project/node_modules/stubs/index.js:28:22)
39+
at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139)
40+
at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5)
41+
at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11)
42+
at PassThrough.ondata (node:internal/streams/readable:1007:22)
43+
at PassThrough.emit (node:events:518:28)
44+
at addChunk (node:internal/streams/readable:559:12) {
45+
code: 'ERR_INVALID_ARG_TYPE'
46+
47+
48+
### 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. **
49+
50+
No library should crash an application this way.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
### Please make sure you have searched for information in the following guides.
2+
3+
- [X] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
4+
- [X] Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
5+
- [X] Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting
6+
- [X] Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq
7+
- [X] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
8+
- [X] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
9+
- [X] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples
10+
11+
### A screenshot that you have tested with "Try this API".
12+
13+
14+
N/A
15+
16+
### Link to the code that reproduces this issue. A link to a **public** Github Repository or gist with a minimal reproduction.
17+
18+
https://gist.github.com/orgads/13cbf44c91923da27d8772b5f10489c9
19+
20+
### A step-by-step description of how to reproduce the issue, based on the linked reproduction.
21+
22+
23+
Change MY_PROJECT to your project name, add credentials if needed and run.
24+
25+
### A clear and concise description of what the bug is, and what you expected to happen.
26+
27+
The application crashes with the following exception (which there is no way to catch). It should just emit error, and allow graceful handling.
28+
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
29+
at _write (node:internal/streams/writable:474:13)
30+
at Writable.write (node:internal/streams/writable:502:10)
31+
at Duplexify._write (/project/node_modules/duplexify/index.js:212:22)
32+
at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139)
33+
at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5)
34+
at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11)
35+
at Pumpify.<anonymous> (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27)
36+
at Object.onceWrapper (node:events:633:26)
37+
at Pumpify.emit (node:events:518:28)
38+
at obj.<computed> [as _write] (/project/node_modules/stubs/index.js:28:22)
39+
at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139)
40+
at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5)
41+
at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11)
42+
at PassThrough.ondata (node:internal/streams/readable:1007:22)
43+
at PassThrough.emit (node:events:518:28)
44+
at addChunk (node:internal/streams/readable:559:12) {
45+
code: 'ERR_INVALID_ARG_TYPE'
46+
47+
48+
### 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. **
49+
50+
No library should crash an application this way.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
### Please make sure you have searched for information in the following guides.
2+
3+
- [X] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
4+
- [X] Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
5+
- [X] Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting
6+
- [X] Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq
7+
- [X] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
8+
- [X] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
9+
- [X] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples
10+
11+
### A screenshot that you have tested with "Try this API".
12+
13+
14+
N/A
15+
16+
### A step-by-step description of how to reproduce the issue, based on the linked reproduction.
17+
18+
19+
Change MY_PROJECT to your project name, add credentials if needed and run.
20+
21+
### A clear and concise description of what the bug is, and what you expected to happen.
22+
23+
The application crashes with the following exception (which there is no way to catch). It should just emit error, and allow graceful handling.
24+
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
25+
at _write (node:internal/streams/writable:474:13)
26+
at Writable.write (node:internal/streams/writable:502:10)
27+
at Duplexify._write (/project/node_modules/duplexify/index.js:212:22)
28+
at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139)
29+
at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5)
30+
at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11)
31+
at Pumpify.<anonymous> (/project/node_modules/@google-cloud/speech/build/src/helpers.js:79:27)
32+
at Object.onceWrapper (node:events:633:26)
33+
at Pumpify.emit (node:events:518:28)
34+
at obj.<computed> [as _write] (/project/node_modules/stubs/index.js:28:22)
35+
at doWrite (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:390:139)
36+
at writeOrBuffer (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:381:5)
37+
at Writable.write (/project/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js:302:11)
38+
at PassThrough.ondata (node:internal/streams/readable:1007:22)
39+
at PassThrough.emit (node:events:518:28)
40+
at addChunk (node:internal/streams/readable:559:12) {
41+
code: 'ERR_INVALID_ARG_TYPE'
42+
43+
### Link to the code that reproduces this issue. A link to a **public** Github Repository with a minimal reproduction.
44+
45+
46+
https://gist.github.com/orgads/13cbf44c91923da27d8772b5f10489c9
47+
48+
### 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. **
49+
50+
No library should crash an application this way.

0 commit comments

Comments
 (0)