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

Parsing template fails due to unsupported type: map[interface {}]interface {} #342

Closed
bottemav opened this issue Mar 30, 2018 · 4 comments
Closed
Labels
area/validate sam validate command

Comments

@bottemav
Copy link
Contributor

Sam local is unable to parse following template.

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

Resources:
  StateMachine:
    Type: "AWS::StepFunctions::StateMachine"
    Properties:
      StateMachineName: "SamStateMachine"
      RoleArn: !Sub "arn:aws:iam::${AWS::AccountId}:role/StateMachineServiceRole"
      DefinitionString:
        !Sub
          - |-
             {
               "Comment": "${application}",
               "StartAt": "HelloWorld",
               "States": {
                 "HelloWorld": {
                   "Type": "Pass",
                   "Result": {
                       "x-datum": 0.381018,
                       "y-datum": 622.2269926397355
                     },
                   "ResultPath": "$.coords",
                   "End": true
                 }
               }
             }
          - {
            application: "applicationName"
          }

When I execute sam validate the following error is thrown
invalid YAML template: json: unsupported type: map[interface {}]interface {}.
I'm running sam local 0.2.7 on Windows 10.

@bgrindy
Copy link

bgrindy commented Mar 30, 2018

I'm dealing with this issue too, same as #135

@sbuzonas
Copy link

sbuzonas commented Apr 3, 2018

It looks like you have your !Sub in the wrong place. It should be in front of a string, not a sequence.

@bottemav
Copy link
Contributor Author

bottemav commented Apr 3, 2018

@sbuzonas You can use a sequence. The first is your string containing parameters and the second specifying the values of these parameters. See Intrinsic Function Reference » Fn::Sub

@bgrindy Replacing !Sub with Fn::Sub: is indeed a workaround.

I don't want to close this issue as SAM Local should support !Sub too.

@jfuss
Copy link
Contributor

jfuss commented May 10, 2018

The validate command was integrated with SAM so this should not be an issue any longer.

Closing as this is fixed in 0.3.0

@jfuss jfuss closed this as completed May 10, 2018
@jfuss jfuss added the area/validate sam validate command label May 10, 2018
qingchm pushed a commit to qingchm/aws-sam-cli that referenced this issue Sep 17, 2021
Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com>
Co-authored-by: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/validate sam validate command
Projects
None yet
Development

No branches or pull requests

5 participants
@sbuzonas @bgrindy @bottemav @jfuss and others