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

YAML is not recognized when using !Sub #30

Closed
hoegertn opened this issue Aug 13, 2017 · 6 comments
Closed

YAML is not recognized when using !Sub #30

hoegertn opened this issue Aug 13, 2017 · 6 comments

Comments

@hoegertn
Copy link

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}
@sanathkr sanathkr added the bug label Aug 13, 2017
@sanathkr
Copy link
Contributor

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

@sanathkr sanathkr added this to the 1.0.0 milestone Aug 13, 2017
@pesama
Copy link
Contributor

pesama commented Aug 13, 2017

Fixed on goformation. Need to update this release.

@sanathkr
Copy link
Contributor

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

@hoegertn
Copy link
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.

@yyolk
Copy link
Contributor

yyolk commented Aug 14, 2017

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

@jagu-sayan
Copy link

I am still getting this error :/

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

5 participants