typelevel / typelevel/feral

`context.callbackWaitsForEmptyEventLoop` is a `var`, actually

Open
#101 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lambda question
Dominant language
Scala
Stars
195
Forks
53
PR merge metrics
No merged PRs in 30d

Description

This is a very interesting example on https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html.

In the following example, the response from Amazon S3 is returned to the invoker as soon as it's available. The timeout running on the event loop is frozen, and it continues running the next time the function is invoked.

const AWS = require('aws-sdk')
const s3 = new AWS.S3()

exports.handler = function(event, context, callback) {
  context.callbackWaitsForEmptyEventLoop = false
  s3.listBuckets(null, callback)
  setTimeout(function () {
    console.log('Timeout complete.')
  }, 5000)
}

We are using the Promise variant of the handler, rather than callback-based. The docs seem to suggest this is different. So maybe this isn't relevant at all, but the bit about the timeout being "frozen" is pretty interesting :) might be worth looking into.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked AWS Lambda Node.js handler documentation and compare its callback-based example with the Promise variant mentioned in the issue. Determine whether the description of context.callbackWaitsForEmptyEventLoop and the frozen timeout applies to both forms; done means the documentation discrepancy and required clarification are identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
cloud, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.