Skip to content

Allow for promise events (javascript) #8

@ghost

Description

BEFORE SUBMITTING AN ISSUE CHECK THE FOLLOWING:

  • I checked existing issues.
  • This is not a support question (which can be answered on Slack).
  • This issue is for Lambda (not the Web Client, API, or Bots)

FEATURE REQUEST

- Describe the feature you would like to see
Would be neat to support promises so we can use async logic in our events.
- Why you need it
See comments below
- How it should work
Something like this:

 exports.handler = (event, context, callback) => {
     // This is used to know how much time you have left for your code
     const time_left = context.getRemainingTimeInMillis;

-    callback(null, handleEvent(event, time_left));

+    Promise.resolve(handleEvent(event, time_left)).then(result =>
+        callback(null, result));

 };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions