Skip to content

Serverless-sam exports template with invalid function names and incomplete template #35

@apsnaidu

Description

@apsnaidu

Hi,
When using serverless-sam to generate SAM template from serverless template which has multiple templates included I'm getting an invalid template with incorrect function names and incomplete template with no handlers.

Here is the log:

serverless sam export --output ./sam-template-generated.yml --profile admin --stage=sit1 --region=ap-southeast-2
Serverless: Working folder: /Users/apsn/Documents/Work/node_modules/serverless-sam
Serverless: Validate
Serverless: Preparing original CloudFormation template
Serverless: Packaging functions
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Export:
Serverless: Exporting resources
Serverless: Exporting outputs
Serverless: Exporting parameters
Serverless: Exporting conditions
Serverless: Exporting functions
Serverless: Exporting function: 0 as 0
Serverless: Exporting function: 1 as 1
Serverless: Exporting function: 2 as 2
Serverless: Exporting function: 3 as 3
Serverless: SAM template written to: /Users/apsn/Documents/Work/sam-template-generated.yml

Here is the sample generated template.

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: 'SAM template for Serverless framework service: '
Resources:
  '0':
    Type: 'AWS::Serverless::Function'
    Properties:
      Runtime: nodejs8.10
      CodeUri: >-
        /Users/apsn/Documents/Work/.serverless/operate-media.zip
      MemorySize: 128
      Timeout: 3
      Environment:
        Variables:
          DYNAMODB_TABLE_NAME: metadata
          AWS_ENVIRONMENT: sit1
          ELASTIC_SEARCH_LOG_LEVEL: trace
          ELASTIC_SEARCH_PORT: 443
          ELASTIC_SEARCH_PROTOCOL: https
          ELASTIC_SEARCH_HOST: >-
            vpc-metadata-sit1-bvtzr43p6vacju.ap-southeast-2.es.amazonaws.com

The function names are exported as 0, 1, 2, 3 etc and there are no handlers generated!

Attached the serverless and generated sam templates.
files.zip

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions