question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid API Gateway Response Keys: set([u'multiValueHeaders']) in with `sam local start-api`

See original GitHub issue

Description

I am trying to test my local function with sam local start-api but it appears to make an useless validation to the response.

Observed result

Invalid API Gateway Response Keys: set([u'multiValueHeaders']) in {u'body': u'{"Status":true,"Message":"OTP Generated"}', u'headers': {u'Content-Type': u'application/json'}, u'multiValueHeaders': {}, u'statusCode': 200}

Function returned an invalid response (must include one of: body, headers or statusCode in the response object). Response received: {"statusCode":200,"headers":{"Content-Type":"application/json"},"multiValueHeaders":{},"body":"{\"Status\":true,\"Message\":\"OTP Generated\"}"}

Expected result

Describe what you expected.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Ubuntu 16.04
  2. sam --version: SAM CLI, version 0.16.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ramblingbarneycommented, Dec 9, 2020

on aws-cli/1.17.13 Python/2.7.17 Linux/4.19.0-10-amd64 botocore/1.14.13

Mounting /home/conor/workspace/sam-app/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container
START RequestId: 471f2d40-3881-4ce7-946d-731b16c60992 Version: $LATEST
fork/exec /var/task/hello-world: no such file or directory: PathError
null
END RequestId: 471f2d40-3881-4ce7-946d-731b16c60992
REPORT RequestId: 471f2d40-3881-4ce7-946d-731b16c60992	Init Duration: 0.39 ms	Duration: 46.55 ms	Billed Duration: 100 ms	Memory Size: 128 MB	Max Memory Used: 128 MB	
Lambda returned empty body!
Invalid lambda response received: Invalid API Gateway Response Keys: {'errorMessage', 'errorType'} in {'errorMessage': 'fork/exec /var/task/hello-world: no such file or directory', 'errorType': 'PathError'}
2020-12-09 21:14:13 127.0.0.1 - - [09/Dec/2020 21:14:13] "GET /hello HTTP/1.1" 502 -

I have this error when running locally, deploying using the guided switch also fails with internal server error when invoked

1reaction
jfusscommented, Dec 7, 2019

@thomasdane if you look at your output closely, you will see that /var/task/main does not exist. This is most likely due to docker shared setting not being configured to allow the directory. If your on windows and already have the drive shared correctly, toggling the setting is the best way to get docker to remember it can share. Your error does not relate to this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sam local start-api go lambda returns 502 "internal server ...
The error message clearly states: Invalid API Gateway Response Keys. I faced a similar error in which I received error for the response...
Read more >
Running API Gateway locally - AWS Documentation
Start a local instance of API Gateway using the sam local start-api AWS SAM CLI command.
Read more >
AWS SAM Configuration for API Gateway Binary Response ...
In this walkthrough, I will use application/zip for example. 1. CloudFormation yaml. To enable Api Gateway Binary Response, you can set x-amazon-apigateway- ...
Read more >
How To Test your AWS Lambda Locally with SAM - YouTube
AWS Lambda functions are extremely powerful FaaS components. In this video, I teach you how to use Serverless Application Model ( SAM )...
Read more >
How to quickly build an API with Lambda, API Gateway, and ...
Learn how to build an API using AWS Lambda, API Gateway, and the AWS Serverless Application Model (SAM) from start to finish.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found