Skip to content

YAML is not recognized when using !Sub #30

Closed

Description

@hoegertn

When trying to use sam-local with the project https://github.com/taimos/serverless-todo-demo it fails with the following error:

ERROR:  did not find expected alphabetic or numeric character (line: 34; col: 0)

Line 34 uses the string substitution for the IAM permission to DynamoDB:

- !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${TodoTable}

Activity

  1. sanathkr commented on Aug 13, 2017

    @sanathkr

    Yet another goformation bug. I'll take a look shortly

  2. added this to the milestone on Aug 13, 2017
  3. pesama commented on Aug 13, 2017

    @pesama
    Contributor

    Fixed on goformation. Need to update this release.

  4. sanathkr commented on Aug 13, 2017

    @sanathkr

    Need a test case to validate fix before release. Is there one?

  5. hoegertn commented on Aug 13, 2017

    @hoegertn
    Author

    I tried with the project I mentioned above and ran sam local start-api or sam validate and both failed with the given error.

  6. yyolk commented on Aug 14, 2017

    @yyolk
    Contributor

    I got pass the initial failure of not being able to parse !Sub by converting a line like:

    Prop: !Sub "my-sub-${RefValue}" throws an error: ☯ sam validate -t sam.yaml 2017/08/14 11:12:19 0.1.0 ERROR: Invalid indentation in template (line: 586; col: 0)

    to

    Prop: !Sub
      - "my-sub-${RefValue}"
      - {}
    

    and got this error:

    2017/08/14 11:12:54 0.1.0
    panic: interface conversion: interface {} is map[interface {}]interface {}, not string
    
    goroutine 1 [running]:
    github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/resources.safeProcessStringArray(0x196b820, 0xc42079ad20, 0x167733c, 0x8, 0xc4201d1bd8)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/resources/safe-processing.go:46 +0x15f
    github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/resources.(*functionTemplate).Scaffold(0xc420286420, 0x196b860, 0xc420139200, 0x0, 0x0, 0xe, 0x168b7c4, 0x26, 0x0)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/resources/aws-serverless-function.go:146 +0x3bf
    github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/resources.(*awsServerlessFunction).Scaffold(0x19bcdc0, 0x196b860, 0xc420139200, 0x0, 0x0, 0x26, 0x0, 0x0, 0x0)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/resources/aws-serverless-function.go:80 +0x6a
    github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/resources.(*awsServerlessFunction).ClassConstructor(0x19bcdc0, 0x196b860, 0xc420139200, 0x0, 0x0, 0x0, 0x0)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/resources/aws-serverless-function.go:61 +0x55
    github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation.postProcess(0x196e4e0, 0xc420132190, 0x196e4e0, 0xc420132190, 0x0, 0x0)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/post-process.go:46 +0x533
    github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation.Parse(0xc420350000, 0x4efb, 0x7e00, 0x4efb, 0x7e00, 0x0, 0x0, 0xc4204a2028, 0x0)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/goformation.go:72 +0x407
    github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation.read(0x1966360, 0xc4204a2028, 0xc4204a2028, 0x0, 0x0, 0x0, 0x1, 0x1)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/goformation.go:40 +0x105
    github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation.Open(0x7fff5fbfec40, 0x8, 0x7fff5fbfec40, 0x8, 0x8, 0x0, 0x0, 0xc420316f90)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/awslabs/goformation/goformation.go:29 +0x27e
    main.validate(0xc4203ccf00)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/validate.go:13 +0x7a
    github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli.HandleAction(0x1587e60, 0x169a720, 0xc4203ccf00, 0xc4204a8800, 0x0)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli/app.go:487 +0x7c
    github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli.Command.Run(0x1677894, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x16971ee, 0xa7, 0x0, ...)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli/command.go:207 +0xb72
    github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli.(*App).Run(0xc42058e680, 0xc42007a080, 0x4, 0x4, 0x0, 0x0)
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/vendor/github.com/codegangsta/cli/app.go:250 +0x7d0
    main.main()
    	/home/ubuntu/repo/src/github.com/awslabs/aws-sam-local/main.go:302 +0x1be1
    
  7. jagu-sayan commented on Mar 6, 2018

    @jagu-sayan

    I am still getting this error :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions