components: website template throwing "service" property is missing in serverless.yml

Description

Running sls or sls deploy results in:

  Serverless Error ---------------------------------------

  "service" property is missing in serverless.yml

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     OS:                     darwin
     Node Version:           10.16.1
     Serverless Version:     1.46.1

Additional Data

I created this project by running the following commands:

serverless create --template-url https://github.com/serverless/components/tree/master/templates/website
cd website
npm install
sls deploy

I’ve tried nesting “name” under “service” in the yaml file but it throws the same error. I was trying to get this to work with my existing angular project but it was having the same issue so I tried to use the template to compare what was different but the template isn’t working either.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 49 (23 by maintainers)

Most upvoted comments

I get this error when using a custom config file and npx. npx serverless --config serverless.dev.yml = “service” property is missing in serverless.dev.yml

If i change my file back to serverless.yml npx serverless = Success

I have the same problem with “service” property missing, but probably a different cause:

My simple serverless.yml for the “website” component worked fine as along as it was in a file named exactly serverless.yml.

component: website-morgler
name: gixtra-frontend
org: morgler
app: gixtra

inputs:
  bucketName: gixtra-frontend-${stage}
  src: ./dist/spa
  region: eu-central-1

(temporarily using my own fork of the component to fix some things)

Once I put the same content into a file named serverless-website.yml and then try to do sls --config serverless-website.yml, I get the error about the missing “service” property.

Why is this different, if nothing but the config file name changed?

Hmm well, that can’t be right. We are setting it right here: https://github.com/serverless/components/blob/master/src/cli/commands/utils.js#L120

Are you running the latest version of the framework?

Thanks for sharing @joshstrange … Yeah that makes total sense. The certificate stuff is auto created for you if you use a domain for the website or backend components. So yeah, this step is not required.

So basically all you need to do is just create a new Public Hosted Zone for your domain, and point to the name servers that AWS provides for you from your domain registrar. Then just wait.

Sounds good! Will add that to the docs👌

@joshstrange thanks for sharing this critical info. Do you might sharing a bit more? (ie. the steps you’ve taken at least on the AWS side, since they’re probably different depending on the registrar)

We’d love to add it to the docs 🙌

@joshstrange Here is the experience you should have: https://www.youtube.com/watch?v=ts26BVuX3j0

Hopefully this helps 😃

Just a suggestion (which I’m sure is not new/novel) but it would be really nice if parts of serverless (maybe start with components?) could expose a list of permissions they need and it could check ahead of time and error out with a “Please add the following IAM permissions to your policy”.

Thanks for your suggestions @joshstrange … we are definitely on the same page here. We are planning a permissions component that would make this a lot easier. You should NOT have to do this manually, you should just deploy and enjoy some Pinacolada in some far away beach 🍹

… I figured it out, it’s spaces/tabs in my yaml

I’m feeling there might be an issue with your yaml indentation. The code snippet you provided shouldn’t be reached if the components project is detected. Could you make sure you’re using correct indentation for the yaml file? or just copy the template above