Repository navigation
Closed
Labels
area/local/start-apisam local start-api commandcontributors/good-first-issueGood first issue for a contributorpriority/1-criticaltype/bug
Description
Description:
Steps to reproduce the issue:
- Function handler
def handler(event, context):
return {'body': json.dumps([]), 'statusCode': 200, 'headers': {"Cache-Control":"max-age=1200"}}
- Resource
TestFunction:
Type: AWS::Serverless::Function
Properties:
Handler: test.handler
Role: !GetAtt FunctionRole.Arn
CodeUri: functions/
AutoPublishAlias: live
Events:
Api:
Type: Api
Properties:
Path: /test
Method: get
- Running
sam local start-apiand trying to requests a http://127.0.0.1:3000/test
Observed result:
Function returned an invalid response (must include one of: body, headers or statusCode in the response object). Response received: b'\n{"body": "[]", "statusCode": 200, "headers": {"Cache-Control": "max-age=1200"}}'
Expected result:
Expecting to have an empty array as a response with status code 200
OS: Ubuntu 16.04
Output of sam --version: 0.4.0
Python version: 3.6.1.
Optional Debug logs:
START RequestId: 90197d0b-c013-4575-bbe0-2eb8c3d67714 Version: $LATEST
END RequestId: 90197d0b-c013-4575-bbe0-2eb8c3d67714
REPORT RequestId: 90197d0b-c013-4575-bbe0-2eb8c3d67714 Duration: 339 ms Billed Duration: 400 ms Memory Size: 128 MB Max Memory Used: 29 MB
2018-07-05 16:52:11 http://localhost:None "GET /v1.35/containers/db47404069e7220f7ee521898dad6f27131a5e8f8b6d2b0a6d035aa3ffd9097e/json HTTP/1.1" 200 None
2018-07-05 16:52:11 http://localhost:None "DELETE /v1.35/containers/db47404069e7220f7ee521898dad6f27131a5e8f8b6d2b0a6d035aa3ffd9097e?force=True&v=False&link=False HTTP/1.1" 204 0
2018-07-05 16:52:11 Function returned an invalid response (must include one of: body, headers or statusCode in the response object). Response received: b'\n{"body": "[]", "statusCode": 200, "headers": {"Cache-Control": "max-age=1200"}}'
2018-07-05 16:52:11 127.0.0.1 - - [05/Jul/2018 16:52:11] "GET /test HTTP/1.1" 502 -
2018-07-05 16:52:11 127.0.0.1 - - [05/Jul/2018 16:52:11] "GET /favicon.ico HTTP/1.1" 403 -
Reacted by Alexandr Marchenko and TATSUNO “Taz” Yasuhiro
Metadata
Metadata
Assignees
Labels
area/local/start-apisam local start-api commandcontributors/good-first-issueGood first issue for a contributorpriority/1-criticaltype/bug
Activity
jfuss commentedon Jul 5, 2018
hmmm... Something is going wrong in this function but at first glance I can't reason about what the actually issue is. I will need to run the cli with pdb with your template and code.
Note: Thank you for providing the code and template. This makes tracking this down much easier!
zsc347 commentedon Jul 6, 2018
I've found a fix.
This line should be
And there is another error which will cause decode exception.
This line shoud be
sanathkr commentedon Jul 6, 2018
@zsc347 Can you send a PR to fix the
>=0bug along with a unit tests? Should be super easy.For the second one, @jfuss is working on this code path in #532. I have made a note of this comment there. He should be able to handle it.
jfuss commentedon Jul 6, 2018
Acknowledging I will handle the second one @zsc347 provided in my current PR @sanathkr linked.
jfuss commentedon Jul 17, 2018
Both bugs called out here were addressed with released v0.5.0
Closing as this is released