这是indexloc提供的服务,不要输入任何密码
Skip to content

fix: remove redundant .then() causing unhandled exception #1671

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

Merged
merged 3 commits into from
Jan 23, 2023

Conversation

garymathews
Copy link
Contributor

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:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1547 🦕

Note: If you are opening a pull request against a legacy branch, PLEASE BE AWARE that we generally won't accept these except for things like important security fixes, and only for a limited time.


I'm not sure why .then() was added here, it appears to be redundant. But without chaining it will cause an unhandled exception; which is causing #1547.

Here's an example of an uncaught exception being thrown when chaining isn't used:

const promise = new Promise((resolve, reject) => {
    reject();
});

promise.then(() => console.log('resolved'));
promise.catch(e => console.error('rejected'));
rejected
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "undefined".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

@garymathews garymathews requested review from a team as code owners December 26, 2022 23:42
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: pubsub Issues related to the googleapis/nodejs-pubsub API. labels Dec 26, 2022
phil-booth-qatalog added a commit to qatalog/nodejs-pubsub that referenced this pull request Jan 6, 2023
viniychuk
viniychuk previously approved these changes Jan 16, 2023
Copy link

@viniychuk viniychuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works! Please merge it!

@garymathews
Copy link
Contributor Author

CC @feywind @alexander-fenster @hongalex

I'd say this is a high priority issue, since without an unhandledException handler the app will just terminate upon receiving an error during an ack

feywind
feywind previously approved these changes Jan 23, 2023
@feywind
Copy link
Collaborator

feywind commented Jan 23, 2023

@garymathews Apologies, I've been OoO and I'm the main maintainer. Hopefully we can get this in quickly.

@feywind feywind added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 23, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 23, 2023
@feywind feywind added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 23, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 23, 2023
@feywind feywind added the automerge: exact Summon MOG for automerging, but approvals need to be against the latest commit label Jan 23, 2023
@gcf-merge-on-green gcf-merge-on-green bot dismissed stale reviews from feywind and viniychuk January 23, 2023 20:38

This review does not reference the most recent commit, and you are using the secure version of merge-on-green. Please re-review the most recent commit.

@feywind feywind merged commit 108edc3 into googleapis:main Jan 23, 2023
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge: exact Summon MOG for automerging, but approvals need to be against the latest commit label Jan 23, 2023
gcf-owl-bot bot added a commit that referenced this pull request Mar 12, 2025
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
gcf-owl-bot bot added a commit that referenced this pull request Mar 27, 2025
PiperOrigin-RevId: 738212310

Source-Link: googleapis/googleapis@803b234

Source-Link: googleapis/googleapis-gen@4f44bd2
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGY0NGJkMmJhYThkZDVhNzFjYTBjZWJkYjE2NGMzYzM0MzQxZWQ4NyJ9

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

feat: deprecate `enabled` field for message transforms and add `disabled` field
docs: deprecate `enabled` field for message transforms and add `disabled` field

PiperOrigin-RevId: 734192973

Source-Link: googleapis/googleapis@263055c

Source-Link: googleapis/googleapis-gen@a0d1189
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTBkMTE4OTczZTY4NTgwZDAwNGUxMzI5ODk2OTEwNDFlYjZlOTEyZCJ9

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

docs: A comment for field `code` in message `.google.pubsub.v1.JavaScriptUDF` is changed

PiperOrigin-RevId: 723009432

Source-Link: googleapis/googleapis@40bc860

Source-Link: googleapis/googleapis-gen@5f52ac8
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWY1MmFjODI0YTA5YTkxZDllNWFmYWRiZTAzMzdiMzUyYmY5MDhlOSJ9

feat: add support for message transforms to Topic and Subscription
docs: Fix link for AnalyticsHubSubscriptionInfo

PiperOrigin-RevId: 721335502

Source-Link: googleapis/googleapis@6161270

Source-Link: googleapis/googleapis-gen@aeb0bb9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWViMGJiOWYxMDRhMzVlM2JkNDViN2ZjOGRlOGVmMjc5ODdhNmU1OCJ9

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Exactly once delivery) BatchError: Failed to "modifyAckDeadline" Reason: 3 INVALID_ARGUMENT.
4 participants