Serverless-application-model: Internal transform failure

Created on 22 Nov 2016  Â·  15Comments  Â·  Source: aws/serverless-application-model

Hi,

I've tried to deploy a simple application with a lambda that reacts to a scheduled event:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
MySimpleFunction:
Type: AWS::Serverless::Function
Properties:
Handler: example.my_handler
Runtime: Python 2.7
CodeUri: s3://my-bucket/lambda-zips/myzip.zip
Role: arn:aws:iam::...:role/lambdaAccess
Events:
MyUploadEvent:
Type: Schedule
Properties:
Schedule: cron(45 10 ? * MON-FRI *)
Events: {"example": "hello world" }

The code itself is one of another test project & works, the codeuri should be valid (zip is in the specified location).

But when I run the aws cloudformation deploy command, I receive an error:

_Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Internal transform failure._

The stack itself is stuck in "review in progress" and does not contain any additional information. Not sure if this is an issue on my side or in the serverless-application-model (though more detailed information than "internal transform failure" would be handy ;)).

Thanks!

Most helpful comment

I’m not sure what the exact problem with the above template is, but I just wanted to chime in on this issue to say that I ran into the “Internal transform failure” a bunch at first too. As it turned out, I had a number of misspellings in my YAML keys, but for a long while I wasn’t sure if something with this new feature was broken in CloudFormation.

It’d be nice if the code that raises this error could provide a better error message. (Ideally with line numbers and such.) And it would be even better if the aws cloudformation validate-template command would run it past the code that raises this error too. :smile:

All 15 comments

Can you post the YAML file with proper formatting & spaces? That will help me figure out if your template has an issue (use the codeblock markdown syntax)

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  MySimpleSlackFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: example.my_handler
      Runtime: Python 2.7
      CodeUri: s3://my-bucket/lambda-zips/myzip.zip
      Role: arn:aws:iam:...:role/lambdaAccess
      Environment:
        Variables:
          CODE: acode
      Events:
        MyUploadEvent:
          Type: Schedule
          Properties:
            Schedule: cron(45 10 ? * MON-FRI *)
            Events: {"example": "hello world" }

(I added the CODE variable yesterday, doesn't change anything about the error.)

I’m not sure what the exact problem with the above template is, but I just wanted to chime in on this issue to say that I ran into the “Internal transform failure” a bunch at first too. As it turned out, I had a number of misspellings in my YAML keys, but for a long while I wasn’t sure if something with this new feature was broken in CloudFormation.

It’d be nice if the code that raises this error could provide a better error message. (Ideally with line numbers and such.) And it would be even better if the aws cloudformation validate-template command would run it past the code that raises this error too. :smile:

Ok, so I played around with the YAML for a bit (after the comment from limulus). Mistake was in the Events section: the property "Events" should have been "Input". :-\

So I guess this issue can be closed. Though I hope error messages will become somewhat more informative. :-)

Glad you found the issue. And sorry the error message wasn't too clear.

I have marked this as a bug to fix the error messaging when we receive an unexpected property

This issue should be fixed now. You will see a more descriptive error message now

It's 2019 and I just ran into the same issue. No descriptive error, just

FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Internal transform failure.

Just hit this myself. No way to tell what the error is.

It's some uncaught error; I agree that this isn't the best experience. We are starting to root cause and fix some of these. In the meantime, open an issue with an example template that causes the error or reach out on slack and we can work through the issue.

@keetonian I had a field named ScheduleExpression instead of Schedule. I was able to figure it out by comparing line by line against the examples. No longer an issue for me, but hopefully this helps you cross another one off the list.

Yeah, a lot of those recently have been with something in the Events section. Thanks for the reply!

Getting the same error here while using Fn:ImportValue under Events:

  GetDataFromLedger:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./main
      Handler: bundle.GetDataFromLedger
      Events:
        getDataApi:
          Type: Api
          Properties:
            Path: /ledger/transaction/{id}
            Method: GET
            RestApiId:
              Fn::ImportValue: !Sub '${env}-${some-exported-name}'

I had same issue but It was because the yaml was not a valid one. Extra spaces at the end of line and no correct alignment

Had the same error, thanks to this thread was able to find and fix the issue.
I had:

Resources:
  # API DEFINITIONS #
  ApiDefinition:
    Type: AWS::Serverless::Api
    Properties:
      StageName: !Ref Deployment
      TracingEnabled: True
      Models:
        AzureRequest:
          Request:
            type: object
            required:
              - id
              - action
            properties:
              id:
                type: string
              action:
                type: string

But I had one too many nested properties in my Models definition after AzureRequest. It should have been:

Resources:
  # API DEFINITIONS #
  ApiDefinition:
    Type: AWS::Serverless::Api
    Properties:
      StageName: !Ref Deployment
      TracingEnabled: True
      Models:
        AzureRequest:
          type: object
          required:
            - id
            - action
          properties:
            id:
              type: string
            action:
              type: string

I have got into similar kind of issue while trying to update the CloudFormation stack (using CLI) to perform ECS blue/green deployments through CodeDeploy:

Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Template parameters modified by transform

Getting similar issue while updating it via AWS console also:
'CodeDeployBlueGreenHook' of type AWS::CodeDeploy::BlueGreen failed with message: java.lang.Object cannot be cast to java.util.Collection

Could not resolve it. If anyone has any idea?

Was this page helpful?
0 / 5 - 0 ratings