Serverless-application-model: No validation of FunctionName

Created on 19 Feb 2019  路  2Comments  路  Source: aws/serverless-application-model

Description:

When deploying an AWS::Serverless::Function with an explicit FunctionName property set, there's no validation that this meets the AWS Lambda function name rules.

Steps to reproduce the issue:

  1. Deploy the following sam template (note that FunctionName includes a forward slash, which is not allowed for function names):
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A hello world application.

Resources:
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.handler
      FunctionName: test/function
      Runtime: nodejs6.10
      CodeUri: src/
  1. Check Cloudformation for errors

Observed result:

Cloudformation returns:

CREATE_FAILED | nullnull (Service: AWSLambdaInternal; Status Code: 400; Error Code: null; Request ID: null)

Expected result:

A validation error that clearly identifies that FunctionName can contain only letters, numbers, hyphens, and underscores.

Most helpful comment

There has been a ticket raised internally 馃榾

All 2 comments

Hi @hwatts, we don't plan on replicating server side validation on the client side.

There has been a ticket raised internally 馃榾

Was this page helpful?
0 / 5 - 0 ratings