(fix): Fix Typescript Timeouts when Lambda handler returns undefined by nhulston · Pull Request #661 · DataDog/datadog-lambda-js

What does this PR do?

Originally, when Lambdas return undefined (this also happens when the return statement is missing), the promisifiedHandler never resolved.

I'm not exactly sure how, but this bug in combination with my changes in #648 caused timeouts in Typescript apps. Timeouts did not occur before #648.

The fix here is to resolve promisifiedHandler even when the handler returns undefined.

I'm not exactly sure why this only affects TS but not JS apps.

Motivation

Typescript Lambdas timing out when returning undefined

Testing Guidelines

Manually - no more timeouts

Added unit test -- fails without this change, passes with the change

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)