Serverless: Declaration error for all declared variable.

Created on 30 Jul 2017  ·  3Comments  ·  Source: serverless/serverless

Description

For bug reports:

  • What went wrong?
    Getting error valid service attribute to satisfy declaration could not be found for all declaration. I don't know whether it's bug or mistake from my side.
  • What was the config you used?
    demo of my config file.
service: MyService
details:
  deploymentBucket: s3_my_bucket

provider:
  name:aws
  deploymentBucket: ${self:details.deploymentBucket}
  stage: dev
  • What stacktrace or error message from your provider did you see?
    A valid service attribute to satisfy the declaration 'self:details.deploymentBucket' could not be found.

Additional Data

  • Serverless Framework Version you're using: 1.18.1
  • Operating System: Ubuntu 16.04
help wanted question

Most helpful comment

@horike37 Works fine. Thank you.

All 3 comments

@gandhi-jay

details section can not be defined on the top level. You can use custom section to do what you want. Here is the document for this and example as follow.
https://serverless.com/framework/docs/providers/aws/guide/variables/

service: MyService
custom:
  deploymentBucket: s3_my_bucket

provider:
  name: aws
  deploymentBucket: ${self:custom.deploymentBucket}
  stage: dev

Could you try again?

@horike37 Works fine. Thank you.

Thanks for lending a helping hand here @horike37 🙌

Glad to hear that this resolves your problem @gandhi-jay 👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

horike37 picture horike37  ·  3Comments

rdehnhardt picture rdehnhardt  ·  3Comments

kevindiamond picture kevindiamond  ·  3Comments

bradgreens picture bradgreens  ·  3Comments

chris-hailstorm picture chris-hailstorm  ·  3Comments