3

AWS makes a case to create a lambda resolver for AppSync that will perform different operations. Since a single query may result in calls to multiple operations, AppSync will invoke the lambda resolver multiple times. I think each invocation will contribute to the overall latency for the request. How does this compare to serverless implementation of Apollo or Express GraphQL Server (GraphQL Server and Resolvers running inside a single lambda function).

Ref. https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-lambda-resolvers.html

exports.handler = (event, context, callback) => {
    switch(event.field) {
        case "operation_1": {/* ... */}
        case "operation_2": {/* ... */}
        case "operation_3": {/* ... */}
        ...
        default: {/* ... */}
    }
};
Jaf
  • 811
  • 2
  • 7
  • 9

0 Answers0