Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.89k stars 1.2k forks source link

Internal Server Error on deployed app #1484

Open INRIX-Joshua-Kidd opened 6 years ago

INRIX-Joshua-Kidd commented 6 years ago

I have managed to deploy a simple hello world app with zappa, however when I visit the URL the app is deployed to all I get is:

{"message": "Internal server error"}

When I tried to run zappa tail I receive the error:

botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the DescribeLogStreams operation: The specified log group does not exist.

Context

I am using a manually created AWS role to handle the zappa application.

My app.py looks like:

import logging
from flask import Flask

app = Flask(__name__)
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

@app.route('/', methods=['GET'])
def lambdahandler(event=None, context=None):
    logger.info('Lambda function invoked index()')

    return 'hello from Flask!'

if __name__ == '__main__':
    app.run()

Expected Behavior

I expect the api to return the text "Hello World!"

Actual Behavior

The API returns

{"message": "Internal server error"}

Steps to Reproduce

The app is live at https://hapcnbby7h.execute-api.us-west-2.amazonaws.com/production

Your Environment

vvalorous commented 6 years ago

Do you the right IAM permissions for the role you are assigning to the Lambda ? Usually it's a sign of Cloudwatch logs are not included in the permissions list.

INRIX-Joshua-Kidd commented 6 years ago

Do you know what the minimum permissions I will need to add are? I'm pretty sure that I have added sufficient permissions.

INRIX-Joshua-Kidd commented 6 years ago

Found the issue, possibly due to the fact I manually created a role. I had to go into my API gateway > settings and manually add in "CloudWatch log role ARN"