Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.83 KB

pipeline-functions.md

File metadata and controls

48 lines (36 loc) · 1.83 KB

Pipeline functions

When you use PIPELINE resolvers, you will also need to define the used pipeline functions. You can do so under the appSync.pipelineFunctions attribute.

It's a key-value pair object whose key is the name of the function and the value is its configuration.

Quick start

appSync:
  pipelineFunctions:
    myFunction:
      dataSource: myDataSource
      code: myFunction.js

Configuration

  • dataSource: The name of the dataSource to use.
  • description: An optional description for this pipeline function.
  • code: The path to the JS resolver handler file, relative to serverless.yml.
  • request: The path to the VTL request mapping template file, relative to serverless.yml.
  • response: The path to the VTL response mapping template file, relative to serverless.yml.
  • maxBatchSize: The maximum batch size to use (only available for AWS Lambda DataSources)
  • substitutions: See Variable Substitutions
  • sync: See SyncConfig

JavaScript vs VTL vs Direct Lambda

When code is specified, the JavaScript runtime is used. When request and/or response are specified, the VTL runtime is used.

To use direct lambda, don't specify anything (only works with Lambda function data sources).

Inline DataSources

Just like with UNIT resolvers, you can define the dataSource inline in pipeline functions.

appSync:
  pipelineFunctions:
    myFunction:
      dataSource:
        type: 'AWS_LAMBDA'
        config:
          function:
            timeout: 30
            handler: 'functions/myFunction.handler'