Skip to content

Adding warning callback handlers and isAsync detection #144

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fabisev
Copy link

@fabisev fabisev commented Jul 16, 2025

Issue #, if available:

Description of changes:

  1. Added warning message for Lambda functions using callback-based handlers:

    • Warning appears when handler has 3 arguments, is not async, and is not streaming
    • Warning can be disabled by setting AWS_LAMBDA_NODEJS_DISABLE_CALLBACK_WARNING environment variable
    • Added unit tests to verify warning behavior across different handler types
  2. Added detection and handling of unresolved promises in async Lambda functions:

    • Introduced NodejsExit error class with descriptive message about unresolved promises
    • Added isAsync detection to identify async Lambda handlers
    • Modified exit listener behavior to fail invocations for async handlers with unresolved promises
    • Maintained existing behavior for sync/callback handlers
    • Added unit tests to verify async handler detection

Target (OCI, Managed Runtime, both):
both

Checklist

  • I have run npm install to generate the package-lock.json correctly and included it in the PR.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant