'Serverless deploy throwing error: "Object notation for "service" property is not supported. Set "service" property directly with service name."

I am building a microservice using Node JS serverless framework. To be honest, this is my first time building a microservice using serverless. I have configured the AWS credentials on my machine already.

I created the project running the following command.

serverless create -u https://github.com/codingly-io/sls-base -n aution-service

Then I run npm install inside the project folder.

This is my serverless.yml folder.

service:
  name: auction-service

plugins:
  - serverless-bundle
  - serverless-pseudo-parameters

provider:
  name: aws
  runtime: nodejs12.x
  memorySize: 256
  stage: ${opt:stage, 'dev'}
  region: eu-west-2
  
functions:
  hello:
    handler: src/handlers/hello.handler
    events:
      - http:
          method: GET
          path: /hello

I already have the lambda function that comes with the template. Then I run serverless deploy to deploy the service. When I run the command, I got the following error.

Error:
Object notation for "service" property is not supported. Set "service" property directly with service name.

What is wrong my configuration or code and how can I fix it?



Solution 1:[1]

You can fix it by setting the name of the service directly to service property like this

service: auction-service

The nested notation is no longer supported.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Progress1ve