Skip to main content
tip

Don't know what a resolver is? See the Architecture section.

Deprecated

From the AWS Documentation, describing the functions used in this resolver: Functions for compatibility with earlier Node.js Runtime v0.10.42. No longer documented, so they are deprecated, but they still work as of the 12.x runtime, so they are not removed from the types.

This resolver only works in AWS and it was created just to be fully compatible with the resolution mode of @vendia/serverless-express.

When the handler is created with getHandler, it will return void and the cloud will wait until the event loop is empty. This happens when your framework sends the response and the adapter transforms the response the way your cloud can handle, at this point the response will be passed to the functions succeed or fail that is exposed by context object.

You can use this resolver only with AWS.

AWS

To use this resolver on AWS, you MUST leave callbackWaitsForEmptyEventLoop as true, otherwise, AWS will not wait for this resolver to resolve.

Usage

To use, you can import and call the method setResolver, as per the code below:

index.ts
import { ServerlessAdapter } from '@h4ad/serverless-adapter';
import { AwsContextResolver } from '@h4ad/serverless-adapter/resolvers/aws-context';

const express = require('express');

const app = express();
export const handler = ServerlessAdapter.new(app)
.setResolver(new AwsContextResolver())
// continue to set the other options here.
//.setFramework(new ExpressFramework())
//.setHandler(new DefaultHandler())
//.addAdapter(new AlbAdapter())
//.addAdapter(new SQSAdapter())
//.addAdapter(new SNSAdapter())
// after put all methods necessary, just call the build method.
.build();