aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

Uncaught Exception complicates debugging

Open netbymatt opened this issue 3 years ago • 5 comments

SDK v3.12.0 Node v14.15.0 Visual Studio Code v1.55.2 for debugging Credentials loaded from ~/.aws/credentials Actual package loaded @aws-sdk/client-s3 v3.12.0

I typically debug with "uncaught exceptions" turned on. The code in line 16 below pre-generates a default rejected promise that is then typically overwritten in the loop on the following lines.

https://github.com/aws/aws-sdk-js-v3/blob/4f9f4a79b019c1c35530e05c4138fde88a6fb547/packages/property-provider/src/chain.ts#L16-L25

Promise.reject is considered an uncaught exception by the debugger thus it pauses here on each debug run. Even though the credentials are ultimately successfully loaded from the default location ~/.aws/credentials I need to step through this "exception" before actually getting to my code that I'm targeting for debug.

I believe a better solution would be to restructure the loop so the final return is where the rejected promise is generated.

netbymatt avatar Apr 15 '21 15:04 netbymatt

This has been driving me absolutely mad the last 3 days

kilotone avatar Jul 01 '21 13:07 kilotone

Still happening with version 3.85.0 I also spent like two hours trying to figure out what I did wrong. Turns out that nothing. I am glad this issue exists at least!

vargaendre avatar May 11 '22 19:05 vargaendre

Has anyone found a workaround to silence that exception in the meantime?

ppold avatar Jul 02 '22 05:07 ppold

Still happening with v3.127.0

belenkymr avatar Aug 02 '22 17:08 belenkymr

+1

SabeehY avatar Sep 25 '22 00:09 SabeehY

+1

berkeleymalagon avatar Oct 04 '22 06:10 berkeleymalagon

+1 ...this is driving my team nuts.

chriskovacs avatar Nov 01 '22 23:11 chriskovacs

+1 this is still happening

nconnector avatar Nov 08 '22 23:11 nconnector

Hi all,

I have marked this for prioritization, if someone wants to take a stab at a PR that would be very appreciated.

Thanks, Ran~

RanVaknin avatar Feb 17 '23 20:02 RanVaknin

We discussed using async-await instead of creating promise.

trivikr avatar Jun 12 '23 17:06 trivikr

Verified that VSCode pauses on Promise.reject when "Uncaught Exceptions" is turned on.

Screen recording

https://github.com/aws/aws-sdk-js-v3/assets/16024985/54a4fff2-b6c9-4a8c-9d78-18abded150eb

trivikr avatar Jun 14 '23 17:06 trivikr

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

github-actions[bot] avatar Jun 29 '23 00:06 github-actions[bot]