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

Failed to publish to SAR with Error: ResultPath being null #1618

Closed
alexcasalboni opened this issue Jun 10, 2020 · 7 comments
Closed

Failed to publish to SAR with Error: ResultPath being null #1618

alexcasalboni opened this issue Jun 10, 2020 · 7 comments

Comments

@alexcasalboni
Copy link

Description: If you deploy a AWS::Serverless::StateMachine with the AWS SAM CLI it works great, but you cannot publish this app/stack to SAR.

Steps to reproduce the issue:

  1. Define a simple app with a AWS::Serverless::StateMachine in it
  2. Run sam package and sam publish

Observed result:
App publication fails with this error:

Error: SAM template is invalid. It cannot be deployed using AWS CloudFormation due to the following validation error: /Resources/powerTuningStateMachine/Type/Definition/States/Cleaner/ResultPath 'null' values are not allowed in templates

Expected result:
I'd expect to app to be published successfully, or at least I'd expect SAM CLI to provide a meaningful error.

@jfuss
Copy link
Contributor

jfuss commented Jun 10, 2020

@alexcasalboni From the error is seems like your template is invalid. SAR supports AWS::Serverless::StateMachine according to their docs: https://docs.aws.amazon.com/serverlessrepo/latest/devguide/list-supported-resources.html.

Can you provide the template (redacted parts if you need to)? It seems like a SAR issue or that your template is not valid.

@jfuss jfuss added the blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. label Jun 10, 2020
@alexcasalboni
Copy link
Author

@jfuss you can find the whole template here: https://github.com/alexcasalboni/aws-lambda-power-tuning/blob/917d021ce5188e75dee7e4bee0452122ce141769/template.yml

The error I get from SAR is about ResultPath being null, which is well documented and works fine when I deploy it.

@cccassidy
Copy link

I was just trying to deploy a stack with the same ResultPath: null setting that @alexcasalboni is using and initially saw that cfn-lint was throwing an error about the null value: E0000 Null value at line X. Came across this issue after searching and I was able to deploy my stack just fine with the null value as well. Maybe SAR is running cfn-lint or something similar and rejects on the error?

@cccassidy
Copy link

cccassidy commented May 6, 2021

Found that the cfn-lint folks are tracking the linter issue, in case they are related.
aws-cloudformation/cfn-lint#1657

@jfuss jfuss changed the title Feature request: AWS::Serverless::StateMachine support for Serverless Application Repository (SAR) Failed to publish to SAR with Error: ResultPath being null Jul 13, 2021
@moelasmar moelasmar removed the blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. label Jul 19, 2021
@nikgibbens
Copy link

This is still a problem with CloudFormation YAML templates in the state machine. It's 2022 and this problem has been around for 2 years. When can we expect a fix?

@kddejong
Copy link
Contributor

kddejong commented Nov 4, 2022

The CloudFormation service doesn't support null values. cfn-lint would capture that error when parsing a template since its not supported by the CloudFormation service. The issue with cfn-lint is resolved and I don't believe its related.

the serverless transform should be converting this to a string (property) which makes the template valid for CloudFormation because the null is now in a string. You can look into cfn-lint issue above for more details on that conversion.

@xazhao
Copy link
Contributor

xazhao commented Mar 1, 2023

Hello! I tried to reproduce this issue and I can publish to SAR with ResultPath: null in a state machine using following template. I believe this issue has been fixed.

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
  sam-app

  Sample SAM Template for sam-app

Metadata:
  AWS::ServerlessRepo::Application:
    Name: my-app
    Description: hello world
    Author: user1
    SpdxLicenseId: Apache-2.0
    Labels: ['tests']
    HomePageUrl: https://github.com/user1/my-app-project
    SemanticVersion: 0.0.1
    SourceCodeUrl: https://github.com/user1/my-app-project


Resources:
  MySampleStateMachine:
    Type: AWS::Serverless::StateMachine
    Properties:
      Definition:
        StartAt: MyLambdaState
        States:
          MyLambdaState:
            Type: Task
            Resource: ARN of a lambda function
            ResultPath: null
            End: true
      Role: ARN of an IAM Role

Close this issue for now and feel free to reopen if you have other questions

@xazhao xazhao closed this as completed Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants