Skip to content

Instantly share code, notes, and snippets.

@wingkwong
Created July 26, 2020 14:00
Show Gist options
  • Save wingkwong/0ddde335639667ec49c0f700edefd262 to your computer and use it in GitHub Desktop.
Save wingkwong/0ddde335639667ec49c0f700edefd262 to your computer and use it in GitHub Desktop.
Converting errant callback-based functions to promised-based ones to avoid AWS Lambda execution leaks
exports.handler = async (event, context) => {
const readFileAsync = util.promisify(readFile);
const result = await readFileAsync('foo.json')
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment