Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Sam when deploying to aws lambda i am facing this error when using flask-lambda package #11

Open
Rumman001 opened this issue Mar 12, 2021 · 2 comments

Comments

@Rumman001
Copy link

[ERROR] KeyError: 'SERVER_NAME'Traceback (most recent call last):  File "/var/task/flask_lambda.py", line 97, in call    return super(FlaskLambda, self).call(event, context)  File "/var/task/flask/app.py", line 2464, in call    return self.wsgi_app(environ, start_response)  File "/var/task/flask/app.py", line 2442, in wsgi_app    ctx = self.request_context(environ)  File "/var/task/flask/app.py", line 2359, in request_context    return RequestContext(self, environ)  File "/var/task/flask/ctx.py", line 292, in init    self.url_adapter = app.create_url_adapter(self.request)  File "/var/task/flask/app.py", line 2171, in create_url_adapter    return self.url_map.bind_to_environ(  File "/var/task/werkzeug/routing.py", line 1594, in bind_to_environ    wsgi_server_name = get_host(environ).lower()  File "/var/task/werkzeug/wsgi.py", line 168, in get_host    rv = environ["SERVER_NAME"] [ERROR] KeyError: 'SERVER_NAME' Traceback (most recent call last):   File "/var/task/flask_lambda.py", line 97, in call     return super(FlaskLambda, self).call(event, context)   File "/var/task/flask/app.py", line 2464, in call     return self.wsgi_app(environ, start_response)   File "/var/task/flask/app.py", line 2442, in wsgi_app     ctx = self.request_context(environ)   File "/var/task/flask/app.py", line 2359, in request_context     return RequestContext(self, environ)   File "/var/task/flask/ctx.py", line 292, in init     self.url_adapter = app.create_url_adapter(self.request)   File "/var/task/flask/app.py", line 2171, in create_url_adapter     return self.url_map.bind_to_environ(   File "/var/task/werkzeug/routing.py", line 1594, in bind_to_environ     wsgi_server_name = get_host(environ).lower()   File "/var/task/werkzeug/wsgi.py", line 168, in get_host     rv = environ["SERVER_NAME"]
@CodeSchwert
Copy link

Are you using an HTTP API or Rest API?

I got the same error when switching from a REST API to HTTP API.

@bhaveshachhada
Copy link

Any updates on this ? I also got the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants