Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stage is added twice and erroneous #45

Closed
StephanPraetsch opened this issue May 28, 2017 · 2 comments
Closed

Stage is added twice and erroneous #45

StephanPraetsch opened this issue May 28, 2017 · 2 comments
Labels
Milestone

Comments

@StephanPraetsch
Copy link

Hi there

if I define the stage with a variable the stage is added twice and the second add is erroneous because the variable is not mapped
myLambda-myStage-${self:custom.stage}

reproduce

serverless create --template aws-java-maven --path myLambda

in the created directory:
change serverless.yml to

service: myLambda
custom:
  stage: myStage
provider:
  name: aws
  runtime: java8
  stage: ${self:custom.stage}
package:
  artifact: target/hello-dev.jar
functions:
  hello:
    handler: com.serverless.Handler
plugins:
  - serverless-aws-alias

then run commands

mvn clean package
npm install --save serverless-aws-alias
serverless deploy -v

The output of the deploy step is

Serverless: Packaging service...
Serverless: Preparing alias ...
Serverless: Processing custom resources
Serverless: Removing resources: 
Serverless: Processing functions
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - myLambda-myStage
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - myLambda-myStage
Serverless: Stack create finished...
 
  Serverless Error ---------------------------------------
 
     The stack alias name "myLambda-myStage-${self:custom.stage}"
     is not valid. A service name should only contain alphanumeric
     (case sensitive) and hyphens. It should start with an
     alphabetic character and shouldn't exceed 128 characters.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless
 
  Your Environment Information -----------------------------
     OS:                 linux
     Node Version:       6.9.1
     Serverless Version: 1.13.2

Best regards

@HyperBrain
Copy link
Member

HyperBrain commented May 28, 2017

Could you add the callstack (printed when SLS_DEBUG=* is set)?

The expectation here would be that the alias plugin creates a second stack (myLambda-myStage-myStage) that acts as the master alias stack.

It might be that the retrieval of the stage name does not cover the custom definition of a stage via variables. I will try to reproduce it, and check how and if the variable substitution is done in this case.

@HyperBrain HyperBrain added the bug label May 28, 2017
@HyperBrain HyperBrain added this to the 1.2.0 milestone May 28, 2017
@HyperBrain
Copy link
Member

The stage and alias names should now be extracted correctly in case the stage is declared as variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants