YAML exception duplicated mapping key

When I run
serverless invoke local --function get --path mocks/get-event.json
in my termal I get the following error message:
duplicated mapping key in “/Users/user/notes-app-api/serverless.yml” at line 57, column 5:
handler: get.main

The other handler is:
handler: create.main

My whole yml file:
service: notes-app-api

Create an optimized package for our functions

individually: true


  • serverless-bundle # Package our functions with Webpack
  • serverless-offline
  • serverless-dotenv-plugin # Load .env as environment variables

name: aws
runtime: nodejs12.x
stage: prod
region: us-east-1

These environment variables are made available to our functions

under process.env.

tableName: notes

‘iamRoleStatements’ defines the permission policy for the Lambda function.

In this case Lambda functions are granted with permissions to access DynamoDB.

- Effect: Allow
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: “arn:aws:dynamodb:us-east-1::


Defines an HTTP API endpoint that calls the main function in create.js

- path: url path is /notes

- method: POST request

- cors: enabled CORS (Cross-Origin Resource Sharing) for browser cross

domain api call

- authorizer: authenticate using the AWS IAM role

handler: create.main
- http:
path: notes
method: post
cors: true
authorizer: aws_iam

# Defines an HTTP API endpoint that calls the main function in get.js
# - path: url path is /notes/{id}
# - method: GET request
handler: get.main
  - http:
      path: notes/{id}
      method: get
      cors: true
      authorizer: aws_iam

I am at add a get note API in the serverless-stack.com. Does any one have any clues as to why it’s doing this and how to fix it?