简体   繁体   中英

AWS API gateway: how to fix "internal server error"

I have a lambda function written in Python 3.6 and testing that from the lambda console works fine returning this as a response

Response:
{
  "statusCode": 200,
  "body": {
    "bank": "my bank",
    "trust_name": "my trust",
    "start_time": "Wed 09 Oct 07:56AM",
    "end_time": "Wed 09 Oct 08:26AM",
    "cost": 111
  }
}

from the lambda function console I clicked add trigger then chose API Gateway once I had an API I created a resource and then a GET method inside that resource

However when I test my endpoint from API gateway I get this in the response body

{
  "message": "Internal server error"
}

I ended up using Chalice a Python Serverless Microframework developed by AWS, enables you to quickly spin up and deploy a working serverless app that scales up and down on its own as required using AWS Lambda.

This deployed my lambda function and hooked it up to API gateway with no issues other than having to add any dependencies through lambda layers manually

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM