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

Wrong type for lambda.invoke callback's err argument

Open surdu opened this issue 2 years ago • 4 comments

Describe the bug

Hello,

Am I missing something or the error argument for the invoke's callback should be optional?

Expected Behavior

The type for err to be AWSError | undefined

Current Behavior

The type for err is AWSError

Reproduction Steps

When mocking the invoke function for tests, the type of the callback's error argument will force me to pass an error, when I don't need to.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

master branch

Environment details (OS name and version, etc.)

N/A

surdu avatar Jun 14 '23 09:06 surdu

Hi @surdu ,

Instead of using callbacks where you are forced to pass in (err, data), you can use async/await.

This should circumvent the need to supply AWSError.

Thanks, Ran~

RanVaknin avatar Jun 14 '23 19:06 RanVaknin

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

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

Thank you for the alternative, but the issue still stands: the err argument should be optional

surdu avatar Jun 20 '23 08:06 surdu

Hi @surdu ,

We could support this. I'm going to mark this as a feature request.

Thanks, Ran

RanVaknin avatar Jun 21 '23 07:06 RanVaknin

Hello, this behavior is different in v3 of the SDK. Please migrate to v3, as we are not currently implementing new features in v2.

kellertk avatar Apr 23 '24 21:04 kellertk