Reputation:
I am trying a simple "Hello World" to deploy a Python-Tornado app to AWS Lambda using Zappa.
The code for the same in app.py file is:
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
def make_app():
return tornado.web.Application([
(r"/", MainHandler),
])
app = make_app()
app.listen(8891)
if __name__ == "__main__":
tornado.ioloop.IOLoop.current().start()
The error I get after I run zappa deploy dev
is
Error: Warning! Status check on the deployed lambda failed. A GET request to '/' yielded a 500 response code.
The error displyed when I run zappa tail
is
__call__() takes 2 positional arguments but 3 were given
The zappa_settings.json file is:
{
"dev": {
"app_function": "app.app",
"aws_region": "ap-south-1",
"profile_name": "default",
"project_name": "dmi-amort",
"runtime": "python3.6",
"s3_bucket": "zappa-mekp987ue",
"manage_roles": false,
"role_name": "lambda-role",
}
}
How can I fix this issue?
Upvotes: 2
Views: 689
Reputation: 22134
Zappa is based on WSGI; Tornado is not. The two are incompatible, so you'll have to replace one of them with an alternative. (I'm not aware of a simple way to combine Tornado with Lambda, so I'd suggest using Zappa with Flask)
In older versions of Tornado, you could use WGSIApplication to get partial support for Tornado in a WSGI environment, but this is no longer available in Tornado 6.0.
Upvotes: 2