2

I am working on a project where I have to use the serverless framework to deploy AppSync with lambda resolvers. My serverless YAML file looks like follows.

service: sls-appsync-backend

plugins:
   - serverless-appsync-plugin
   - serverless-offline
   - serverless-pseudo-parameters

provider:
  name: aws
  runtime: nodejs12.x
  region: ap-southeast-2

functions:
  graphql:
    handler: src/handler.graphql

custom:
  accountId: #{AWS::AccountId}
  appSync:
    name: sls-appsync-api
    authenticationType: AMAZON_COGNITO_USER_POOLS
    userPoolConfig:
      awsRegion:  us-east-1
      defaultAction: ALLOW
      userPoolId:  { Ref: CognitoUserPool } 
    mappingTemplates:
      - dataSource: awsLambdaDataSource
        type: Query #Query, Mutation, Subscription
        field: helloWorld
        request: "helloWorld-request-mapping-template.txt"
        response: "helloWorld-response-mapping-template.txt"
    schema: # defaults schema.graphql
    serviceRole: "AppSyncServiceRole"
    dataSources:
      - type: AWS_LAMBDA
        name: awsLambdaDataSource
        description: 'Lambda DataSource'
        config:
          lambdaFunctionArn: { Fn::GetAtt: [GraphqlLambdaFunction, Arn] } # Where GraphqlLambdaFunction is the lambda function cloudformation resource created by serverless for the serverless function named graphql
          serviceRoleArn: { Fn::GetAtt: [AppSyncLambdaServiceRole, Arn] }

I want to run this on my local machine in order to debug and test. I am stuck in here and is there anybody who can help?

0 Answers0