Aws-sam-cli: template.yml inside folder breaks 'sam local invoke'

Created on 26 Sep 2017  路  2Comments  路  Source: aws/aws-sam-cli

I'm trying to have a better folder structure, and found this little issue:

If I do

sam local invoke QuestionPosted \
        --template cloudformation/template.yml \
        --event events/valid.json
````

I get the following error:

2017/09/26 11:59:51 Successfully parsed cloudformation/template.yml
2017/09/26 11:59:51 Connected to Docker 1.30
2017/09/26 11:59:52 Fetching lambci/lambda:python2.7 image for python2.7 runtime...
python2.7: Pulling from lambci/lambda
Digest: sha256:4a5ca6fae14957e614a151117213279ca625f20b098dc5a6cf2466e93feedbc4
Status: Image is up to date for lambci/lambda:python2.7
2017/09/26 11:59:54 Invoking code.handler (python2.7)
START RequestId: 165b3824-a26d-413e-9583-940a4a46cdef Version: $LATEST
Handler 'handler' missing on module 'code': 'module' object has no attribute 'handler'
END RequestId: 165b3824-a26d-413e-9583-940a4a46cdef
REPORT RequestId: 165b3824-a26d-413e-9583-940a4a46cdef Duration: 2 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 14 MB

{"errorMessage": "Handler 'handler' missing on module 'code'"}


I would expect this to work, because it does when I try: 

sam local invoke QuestionPosted \
--template template.yml \
--event events/valid.json
````

And both _template.yml_ files are the same.

documentation bug

Most helpful comment

Agreed. There is some logic inside SAM Local that tries to resolve CodeUri location & template file location relative to pwd. It is working as expected. But it might be worth documenting how this works and providing helping logging so you don't run into this issue

All 2 comments

Agreed. There is some logic inside SAM Local that tries to resolve CodeUri location & template file location relative to pwd. It is working as expected. But it might be worth documenting how this works and providing helping logging so you don't run into this issue

This should be more obvious with latest version of SAM CLI - v0.3.0. Closing this issue because this bug has been fixed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Caian picture Caian  路  3Comments

dschu-lab picture dschu-lab  路  3Comments

jpbarto picture jpbarto  路  4Comments

cmccoypdx picture cmccoypdx  路  3Comments

goldenbearkin picture goldenbearkin  路  3Comments