Comments (8)
If you look inside the zip file created by serverless, du you see a .requirements
directory?
from serverless-wsgi.
Yes, everything is in place and the "missing" werkzeug
is in the folder. I think the problem might be with the python path adding, but I cannot check it, at least easily, as wsgi.py
, which is the main point of entry, does not load.
from serverless-wsgi.
I just tried deploying the example from the README, using this serverless.yml
file:
service: example
provider:
name: aws
runtime: python2.7
plugins:
- serverless-wsgi
package:
exclude:
- node_modules/**
functions:
api:
handler: wsgi.handler
events:
- http:
path: cats
method: get
integration: lambda-proxy
- http:
path: dogs/{id}
method: get
integration: lambda-proxy
custom:
wsgi:
app: api.app
Producing the following Lambda bundle:
https://dl.dropboxusercontent.com/u/313905/example.zip
Could you check how it compares to your bundle?
from serverless-wsgi.
OK I've found that the datastructures.py
from werkzeug
were missing. The reason was that in my serverless.yml
I had exclude as follows:
exclude:
- data
This meant to exclude my data folder; when I changed it to - data/
only the folder is excluded correctly. I was not aware that this form of exclude works as a global wildcard.
Nonetheless, I get a new error now:
u'requestContext': KeyError Traceback (most recent call last): File "/var/task/wsgi.py", line 34, in handler script_name = '/
{}
'.format(event[u'requestContext'].get(u'stage', '')) KeyError: u'requestContext'
It may be related with the fact I' using CORS in Serverless:
events:
- http:
path: task
method: get
integration: lambda-proxy
cors: true
from serverless-wsgi.
Strange, enabling CORS does not cause any issues for my example (it shouldn't, as the CORS setting will just add an OPTIONS method to APIGW).
According to AWS docs, requestContext
should always be available for LAMBDA-PROXY integrations. Could you check in API Gateway, that your endpoint is indeed configured with a LAMBDA-PROXY integration? Also, I assume that you're seeing that error in the logs after invoking the Lambda through a HTTP call to API Gateway, right?
from serverless-wsgi.
The last one did the trick, though, for some reason, serverless.yml
setting as above, i.e.:
events:
- http:
path: task
method: get
integration: lambda-proxy
cors: true
doesn't change the Integration Request: I had to change it manually. Also I've tested it on a vanilla environment and it still doesn't trigger the integration setting. But after setting it manually, Serverless doesn't change the setting back, so it's fine for now at least.
I also tested it adding two new endpoints foo
and bar
, with and without CORS, respectively. In both cases the lambda-proxy setting hasn't been added.
Do you think this is related with your project or should I report it to Serverless directly?
Thank you very much for the help!
from serverless-wsgi.
Ok, great that you found the issue. It definitely sounds like a Serverless bug, and you should be able to reproduce regardless of using this plugin. I'll close this issue and it would be cool if you could report directly to Serverless!
from serverless-wsgi.
Just leaving a note: the issue with setting integration was related to older version of Serverless I had, namely, 1.0.0-rc2; after updating to 1.0.2 the issue dissipated.
from serverless-wsgi.
Related Issues (20)
- How do you have two entry points, one for JWT and one for non-JWT authorized WSGI handlers?
- Error: ENOTDIR: not a directory HOT 2
- Serverless wsgi application and aws http api fail to integrate HOT 1
- empty header in event HOT 1
- Any reason why we are raising an exception here?
- Cannot deploy Hello World
- Unable to link dependency 'click' because a file by the same name exists in this service
- Attempting to run sls wsgi serve locally is freezing
- -c no longer works but --command does HOT 1
- Question: http/1.1 chunked transfer encoding
- hasbin dependency
- tag 3.0.1 does not contain some fixes from master. HOT 2
- Response contain status code and headers HOT 2
- I got error when I deploy Flask app on AWS lambda HOT 1
- AWS Custom Authorizer via django (drf)
- Provide function to execute when calling sls wsgi command
- Alternative directory structure does not seem to work
- replace calls to werkzeug.urls with urllib.parse HOT 6
- Request for new release based on latest master branch HOT 2
- Finalize Deploy Hook not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-wsgi.