Skip to content

Program exits with no error(s) when there is error inside expression in serverless.yml #4699

@alekbarszczewski

Description

@alekbarszczewski

This is a Bug Report

Description

When there is error in serverless.yml file then when executing for example sls deploy or sls package or any other command that reads that file, then program exits and no errors are returned in console. In the config below there is error in provider.environment.S3_BUCKET_URL:

S3_BUCKET_URL: https://s3-${opt:region, self:provider.region}.amazonaws.com/${self:provider:environment.S3_BUCKET}

It should be ${self:provider.environment.S3_BUCKET} instead of ${self:provider:environment.S3_BUCKET} (note : after provider).

Try to run sls deploy command with this config - program will just exit with no errors. Expecting to display error about bad expression in serverless.yml file.

service: hello-world

provider:
  name: aws
  runtime: nodejs6.10
  environment:
    DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}
    S3_BUCKET: ${self:service}-${opt:stage, self:provider.stage}-audio-files
    S3_BUCKET_URL: https://s3-${opt:region, self:provider.region}.amazonaws.com/${self:provider:environment.S3_BUCKET}
    SNS_TOPIC_CONVERT_TEXT_TO_SPEECH: arn:aws:sns:${opt:region, self:provider.region}:#{AWS::AccountId}:convertTextToSpeech
  iamRoleStatements:
      - Effect: Allow
        Action:
          - sns:Publish
        Resource: "${self:provider.environment.SNS_TOPIC_CONVERT_TEXT_TO_SPEECH}"
      - Effect: Allow
        Action:
          - dynamodb:Query
          - dynamodb:Scan
          - dynamodb:GetItem
          - dynamodb:PutItem
          - dynamodb:UpdateItem
          - dynamodb:DeleteItem
        Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
      - Effect: Allow
        Action:
          - s3:PutObject
          - s3:PutObjectAcl
        Resource: "arn:aws:s3:::${self:provider.environment.S3_BUCKET}/*"
      - Effect: Allow
        Action:
          - polly:SynthesizeSpeech
        Resource: "*"

plugins:
  - serverless-offline
  - serverless-pseudo-parameters

functions:
  graphql:
    handler: dist/app.handler
    events:
      - http:
          path: graphql
          method: post
          cors: true
  convertTextToSpeech:
    handler: dist/tasks/convertTextToSpeech.handler
    events:
      - sns:
          topicName: convertTextToSpeech
          displayName: Convert text to speech

resources:
  Resources:
    AudioFilesDynamoDbTable:
      Type: 'AWS::DynamoDB::Table'
      DeletionPolicy: Retain
      Properties:
        AttributeDefinitions:
          - AttributeName: id
            AttributeType: S
        KeySchema:
          - AttributeName: id
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
        TableName: ${self:provider.environment.DYNAMODB_TABLE}
    AudioFilesBucket:
        Type: AWS::S3::Bucket
        Properties:
          BucketName: ${self:provider.environment.S3_BUCKET}

Additional Data

  • Serverless Framework Version you're using: 1.26.0
  • Operating System: Mac OS X
  • Node.js: v8.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions