@lamware/do-not-wait
v2.0.1
Published
Lamware Middleware to disable Lambda waiting for an empty event loop
Readme
This Lamware Middleware implements a Lambda best-practice of making sure Lambda doesn't wait for the event loop to be empty prior to responding by ensuring the callbackWaitsForEmptyEventLoop context variable is set to false.
Installation
This package is available via NPM:
yarn add @lamware/do-not-wait
# or
npm install @lamware/do-not-waitUsage
import type { APIGatewayProxyHandlerV2 } from 'aws-lambda';
import { doNotWait } from '@lamware/do-not-wait';
import { lamware } from '@lamware/core';
const { handler } = lamware<APIGatewayProxyHandlerV2<any>>()
.use(doNotWait())
.execute(async () => {
return { statusCode: 200 };
});
export { handler };