5

When you need to access multiple resources (eg different DynamoDB tables) from a single custom gql operation using AWS Amplify, why would you use pipeline resolvers over lambda resolvers, and vice versa? From reading around, there seems to be very little information regarding the advantages/disadvantages of each approach, as well as use cases where one might be better than the other.

I've read that debugging pipeline resolvers is a nightmare because you can't print/console.log, so if true, that is one huge downside of pipeline resolvers and a reason to use lambdas instead...

1 Answer 1

6

Some thoughts (though not exhaustive):

  1. AppSync Pipeline Resolvers do not incur the added cost of a Lambda function
  2. Pipeline Resolvers may be faster, since they don't have to make the extra hop to Lambda (though you should test yourself to confirm)
  3. Lambda may provide a more familiar programming model to you, depending on your experience.
  4. Lambda may also allow you to perform other, more complex operations that cannot be achieved by VTL in AppSync.

That said, you don't necessarily need pipeline resolvers to access multiple data sources; you can set up multiple data sources with multiple resolvers that can be executed in the same request.

You might also want to look at https://github.com/serverless/serverless-graphql/issues/248 which contains an interesting discussion on the advantages and disadvantages of using multiple DynamoDB tables behind an AppSync API.

1
  • 1
    Another interesting one I learned today, any logic put into a lambda can be easier to iterate on for new features. So if it's something you anticipate changing or adding to it often it might be better separated out.
    – Ulthran
    Oct 15, 2021 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.