Skip to content

Function returned an invalid response #134

Closed
@sebastientromp

Description

@sebastientromp
  • Framework version: 1.0
  • Implementations: Spring Boot

Scenario

  • I created the archetype using
 mvn archetype:generate -DgroupId=my.service -DartifactId=my-service -Dversion=1.0-SNAPSHOT        -DarchetypeGroupId=com.amazonaws.serverless.archetypes  \
      -DarchetypeArtifactId=aws-serverless-springboot-archetype \
      -DarchetypeVersion=1.0.1
  • I run mvn package
  • Then started sam using sam local start-api --template sam.yaml with output
2018/03/11 15:12:19 Connected to Docker 1.35
2018/03/11 15:12:19 Fetching lambci/lambda:java8 image for java8 runtime...
java8: Pulling from lambci/lambda
Digest: sha256:c2ec8db145bbe44154dbddcdd2976ab8afd60d58d7d633dc98f53f657c0ef909
Status: Image is up to date for lambci/lambda:java8

Mounting my.service.StreamLambdaHandler::handleRequest (java8) at http://127.0.0.1:3000/{proxy+} [OPTIONS GET HEAD POST PUT DELETE PATCH]

You can now browse to the above endpoints to invoke your functions.
You do not need to restart/reload SAM CLI while working on your functions,
changes will be reflected instantly/automatically. You only need to restart
SAM CLI if you update your AWS SAM template.
  • Then tried to call the /ping endpoint at curl -s http://127.0.0.1:3000/ping | python -m json.tool

Expected behavior

The server replies with a "pong" message

Actual behavior

2018/03/11 15:12:46 Invoking my.service.StreamLambdaHandler::handleRequest (java8)
2018/03/11 15:12:46 Decompressing G:\Source\lambdas\my-service\target\my-service-1.0-SNAPSHOT.jar
2018/03/11 15:13:49 Mounting /c/Users/Daedin/AppData/Local/Temp/aws-sam-local-1520777566162251000 as /var/task:ro inside runtime container
START RequestId: 48dfc4ef-52c7-4674-8bf3-1853e7e8f4d4 Version: $LATEST
END RequestId: 48dfc4ef-52c7-4674-8bf3-1853e7e8f4d4
REPORT RequestId: 48dfc4ef-52c7-4674-8bf3-1853e7e8f4d4  Duration: 9083.56 ms    Billed Duration: 9100 ms        Memory Size: 512 MB     Max Memory Used: 15 MB
2018/03/11 15:14:01 Function returned an invalid response (must include one of: body, headers or statusCode in the response object): invalid character '-' after top-level value

which results in an Internal Server Error

Steps to reproduce

See description

Full log output

$ sam local start-api --template sam.yaml
2018/03/11 15:12:19 Connected to Docker 1.35
2018/03/11 15:12:19 Fetching lambci/lambda:java8 image for java8 runtime...
java8: Pulling from lambci/lambda
Digest: sha256:c2ec8db145bbe44154dbddcdd2976ab8afd60d58d7d633dc98f53f657c0ef909
Status: Image is up to date for lambci/lambda:java8

Mounting my.service.StreamLambdaHandler::handleRequest (java8) at http://127.0.0.1:3000/{proxy+} [OPTIONS GET HEAD POST PUT DELETE PATCH]

You can now browse to the above endpoints to invoke your functions.
You do not need to restart/reload SAM CLI while working on your functions,
changes will be reflected instantly/automatically. You only need to restart
SAM CLI if you update your AWS SAM template.

2018/03/11 15:12:46 Invoking my.service.StreamLambdaHandler::handleRequest (java8)
2018/03/11 15:12:46 Decompressing G:\Source\lambdas\my-service\target\my-service-1.0-SNAPSHOT.jar
2018/03/11 15:13:49 Mounting /c/Users/Daedin/AppData/Local/Temp/aws-sam-local-1520777566162251000 as /var/task:ro inside runtime container
START RequestId: 48dfc4ef-52c7-4674-8bf3-1853e7e8f4d4 Version: $LATEST
END RequestId: 48dfc4ef-52c7-4674-8bf3-1853e7e8f4d4
REPORT RequestId: 48dfc4ef-52c7-4674-8bf3-1853e7e8f4d4  Duration: 9083.56 ms    Billed Duration: 9100 ms        Memory Size: 512 MB     Max Memory Used: 15 MB
2018/03/11 15:14:01 Function returned an invalid response (must include one of: body, headers or statusCode in the response object): invalid character '-' after top-level value

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions